当前位置:网站首页>How to add a condition for an associated table in an SQL statement [null value required or not required]
How to add a condition for an associated table in an SQL statement [null value required or not required]
2022-07-01 02:08:00 【pingzhuyan】
Catalog
Didn't understand the message , Baidu search for a long time basically wants few
1. Unwanted null value
hold and Put the condition at the end
SELECT
ad.dept_id,
ad.dept_name,
au.id,
au.realname
FROM
user_post aup
LEFT JOIN dept ad ON aup.dept_id = ad.dept_id
left join build_rec_user abru
on abru.order_id=ad.dept_id
LEFT JOIN user au ON au.id = abru.user_id
WHERE ad.company_id = 100 and abru.type_id = 0
2. need null value
In fact, in the left join ... on Add later and Conditions = ? Screening Associated library condition
Example : left join build_rec_user abru
on abru.order_id=ad.dept_id and abru.type_id = 0
SELECT
ad.dept_id,
ad.dept_name,
au.id,
au.realname
FROM
user_post aup
LEFT JOIN dept ad ON aup.dept_id = ad.dept_id
left join build_rec_user abru
on abru.order_id=ad.dept_id
and abru.type_id = 0
LEFT JOIN user au ON au.id = abru.user_id
WHERE ad.company_id = 100
Didn't understand the message , Baidu search for a long time basically wants few
边栏推荐
- After working for 6 years, let's take stock of the golden rule of the workplace where workers mix up
- What is PMP?
- 机器学习9-通用逼近器径向基函数神经网络,在新观点下审视PDA和SVM
- The image variables in the Halcon variable window are not displayed, and it is useless to restart the software and the computer
- 【agora】用户管理
- RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
- 7-2 punch in reward DP for puzzle a
- opencv -- 笔记
- halcon变量窗口的图像变量不显示,重启软件和电脑都没用
- How does ZABBIX configure alarm SMS? (alert SMS notification setting process)
猜你喜欢
SWT/ANR问题--Binder Stuck
A preliminary understanding of operator overloading
CorelDRAW 2022 Chinese Simplified 64 bit direct download
Analysis on user behavior loss of data exploration e-commerce platform
正向代理和反向代理快速理解
(翻译)使用眉状文本提高标题点击率
QML控件类型:ToolTip
Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
Qu'est - ce que le PMP?
My PMP learning test experience
随机推荐
522. 最长的特殊序列 II
Handsontable data grid component
工厂+策略模式
Calculate special bonus
With one-stop insight into industry hot spots, the new function "traffic market" of feigua data station B is launched!
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
机器学习10-信念贝叶斯分类器
A preliminary understanding of operator overloading
模板:全局平衡二叉树
Clickhouse 消除由group by产生的间隙
With regard to the white box test, you have to master these skills~
Mathematical knowledge: finding combinatorial number IV - finding combinatorial number
CorelDRAW 2022中文精简64位直装版下载
7-2 拼题A打卡奖励 dp
What is PMP?
QT web development - VIDEO - Notes
先写API文档还是先写代码?
URLs and URIs
小程序云开发之--微信公众号文章采集篇
How do the top ten securities firms open accounts? Also, is it safe to open an account online?