左连接2表的解决方案左连接第三个表 [英] Left Join 2 tables's solution left join the third Table
本文介绍了左连接2表的解决方案左连接第三个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个表,A,B和C.
我想在B中获取数据,其中B.id不在A.解决方案,我必须使用C给你带来的好处
我真的很困惑,请帮助
解决方案
你好,
加入SQL Server和不同类型的联接示例
谢谢
你有两个方法这样做
选择 B. * FROM B
LEFT JOIN A ON A.ID = B.ID
LEFT JOIN C ON C.Column_name = B.Column_name
其中 A.IDIS NULL
其他是
选择 B. * FRom B
LEFT JOIN C ON C.Column_name = B.Column_name
where B.ID 不 IN (选择 A.ID 从 A)
* Column_name表示您需要提供您愿意在B和C之间进行的列名
Hi,
I have 3 Tables, A,B and C.
I want to get data in B where B.id is not in A. and this slolution, i have to LeftJoin With the C
I am really confused, please help
解决方案
Hello ,
Joins in SQL Server and different types of Joins example
thanks
You have two ways to do this
Select B.* FROM B LEFT JOIN A ON A.ID = B.ID LEFT JOIN C ON C.Column_name = B.Column_name Where A.ID IS NULL
The Other is
Select B.* FRom B LEFT JOIN C ON C.Column_name = B.Column_name where B.ID NOT IN (SElect A.ID From A)
*Column_name means you need to give column name you are willing to do between B and C
这篇关于左连接2表的解决方案左连接第三个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文