I want to join two tables, but I want only the arent matches on the right side to be displayed in the result set.
Example:
Lefttable
Righttable
leftID | Fk
select l.value
from LeftTable l
attach RightTable r
on l.leftID = r.leftID
I know that this will not give me what I want, but I'm just trying to figure out which elements in the left table are NOT displayed on the right side using the foreign key relation leftID.
Any ideas?
What if we do
select LT.value from LeftTable LT left outer join RightTable RT on LT.leftID = RT.leftID Where RT.leftId is null
SO join , , , . where , .
, - LEFT JOIN, [INNER] JOIN, , , .. NULL
SELECT T1.value FROM LeftTable T1 LEFT JOIN RightTable T2 ON T1.leftID = T2.leftID WHERE T2.leftID IS NULL
select * from LeftTable where leftID not in (select leftID from RightTable)
SELECT LeftID FROM LeftTable LEFT OUTER JOIN RightTable ON LeftTable.LeftID = RightTable.LeftID WHERE RightTable.RightId IS NULL
, exists, where not in. left outer join , , .
exists
where not in
left outer join
select left.* from LeftTable as left where not exists ( select * from RightTable as right where right.RightID = left.LeftID )
Source: https://habr.com/ru/post/1729441/More articles:IPP reference errors on cygwin - c ++Who will take on the role of Friend functions in java, like in C ++? - javaPhp: creating functions in a for () loop - cCreate Android Screen Splash / Loading - androidCombine aspnetdb database with another? - asp.netchange x509 advanced properties / usage - c #как аутентифицировать пользователя веб-сервиса ASP.NET, который является частью веб-приложения ASP.NET? - authenticationHow can I print Ruby syntax code? - ruby | fooobar.comProblem with managing WebBrowser - c #Как избежать цикла перенаправления в ASP.NET MVC - redirectAll Articles