当前位置:网站首页>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 = 02. 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
边栏推荐
- SWT / anr issues - ams/wms
- Laravel event & Monitoring
- 如何选择券商?另外,手机开户安全么?
- [JS adds attributes to elements: setAttribute; classlist.remove; classlist.add;]
- FL Studio20.9水果软件高级中文版电音编曲
- (translation) reasons why real-time inline verification is easier for users to make mistakes
- electron之坑addon
- Open source basic software companies, looking for you to create the future together (api7.ai)
- SWT/ANR问题--ANR/JE引发SWT
- org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
猜你喜欢
![Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]

FL Studio20.9水果软件高级中文版电音编曲

7-2 punch in reward DP for puzzle a

Upstream and downstream in software development

The whole process of AS400 API from zero to one

PMP是什麼?

7-2 拼题A打卡奖励 dp

小程序云开发之--微信公众号文章采集篇

Working for eight years as a programmer, but with a salary of three years after graduation, it's too late to be enlightened again

SWT / anr problem - binder stuck
随机推荐
(translation) reasons why real-time inline verification is easier for users to make mistakes
【毕业季·进击的技术er】--毕业到工作小结
What are the preferential activities for stock account opening? In addition, is it safe to open a mobile account?
Necessary tools for testing - postman practical tutorial
Log4j2 ThreadContext日志链路追踪
AS400 large factory interview
PHP array splicing MySQL in statement
Log4j2 threadcontext log link tracking
How does ZABBIX configure alarm SMS? (alert SMS notification setting process)
P6773 [NOI2020] 命运(dp、线段树合并)
The image variables in the Halcon variable window are not displayed, and it is useless to restart the software and the computer
[fundamentals of wireless communication-15]: illustrated mobile communication technology and application development-3-overview of digital communication 2G GSM, CDMA, 3G wdcma/cdma200/td-scdma, 4G LTE
What is PMP?
SWT/ANR问题--Deadlock
FL Studio20.9水果软件高级中文版电音编曲
Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry
A preliminary understanding of operator overloading
PHP converts two-dimensional array elements into key value pairs
2022年最新csdn涨薪技术栈-app自动化测试概述
如何选择券商?另外,手机开户安全么?