当前位置:网站首页>left join左连接匹配数据为NULL时显示指定值
left join左连接匹配数据为NULL时显示指定值
2022-07-01 00:32:00 【大胖某人】
一般情况left join 匹配出的数据
select a.num,a.username,b.mdn from jieban_tmp_hmc a left join b_tel b on a.username=b.username order by a.num
匹配不到的数据显示为空
COALESCE是一个函数, (expression_1, expression_2, …,expression_n)依次参考各参数表达式,遇到非null值即停止并返回该值。如果所有的表达式都是空值,最终将返回一个空值。使用COALESCE在于大部分包含空值的表达式最终将返回空值。
select a.num,a.username,coalesce(b.mdn,'无数据') MDN from jieban_tmp_hmc a left join b_tel b on a.username=b.username order by a.num
加上coalesce函数后,匹配到数据的正常显示,为空的显示指定值
边栏推荐
- Red hat will apply container load server on project atomic
- Solutions to errors in installing OpenSSL for CentOS 6.3 x64 PHP 5.2.6 extensions
- Quick start of wechat applet -- project introduction
- Techo youth 2022 academic year college open class: behind the live broadcast of Lianmai, explore how to apply audio and video technology
- BeanUtils. Copyproperties() vs. mapstruct
- Analysis of 8253a register
- The programmer's girlfriend gave me a fatigue driving test
- 如何关闭一个开放的DNS解析器
- 8253A寄存器浅析
- The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
猜你喜欢

2022-2028 global electric yacht industry research and trend analysis report

20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br

1. crawler's beautifulsoup parsing library & online parsing image verification code

Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)

MaxPool2d详解--在数组和图像中的应用

6-1 exploit -ftp exploit

5G智慧建筑解决方案2021

CentOS install MySQL

深入理解 Jetpack Compose 内核:SlotTable 系统

Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
随机推荐
Never use redis expired monitoring to implement scheduled tasks!
6-1 exploit -ftp exploit
ABAQUS 2022 latest edition - perfect realistic simulation solution
The programmer's girlfriend gave me a fatigue driving test
2022-2028 global rampant travel industry research and trend analysis report
Tide - rust web framework based on async STD
CentOS install MySQL
Pycharm useful shortcut keys
PS2 handle-1 "recommended collection"
Rust book materials - yazhijia Library
需求评审,测试人员应该发挥怎样的价值?两分钟让你不再懵逼
leetcode 474. Ones and zeroes (medium)
Solutions to errors in installing OpenSSL for CentOS 6.3 x64 PHP 5.2.6 extensions
Repetition is the mother of skill
76 page comprehensive solution 2022 for smart Logistics Park (download attached)
Solving the weird problem that the query conditions affect the value of query fields in MySQL query
What does it mean to open an account online? Is it safe to open an account online?
Error 2059 when Navicat connects to MySQL
1175. prime number arrangement / Sword finger offer II 104 Number of permutations
LVM snapshot: backup based on LVM snapshot