, (, , ) , :
select *
from Persons P
join anothertable A on A.Name = P.FamilyName
where P.Age = 20
, select .
,
select *
from Persons P
join anothertable A on A.Name = P.FamilyName and P.CheckFamilyName= true
where P.Age = 20
, CheckFamilyName .
So we make it a left join.
select *
from Persons P
left join anothertable A on A.Name = P.FamilyName and CheckFamilyName= true
where P.Age = 20
This will contain lines where checkfamilyname is true, but the name does not exist - for checking those you can do as follows:
select *
from Persons P
left join anothertable A on A.Name = P.FamilyName and CheckFamilyName= true
where P.Age = 20 and (checkfamilyname = A.Name is not null)
Hogan source
share