I have two tables.
**Employee**
EmpId NOT NULL (PK)
Name NOT NULL
OrgID NULL (FK)
**Organisation**
OrgID NOT NULL (PK)
OrgName NOT NULL
I want to get Name,OrgName with one select statement.
but condition is OrgID can be null in Employee table. So many records without OrgID and records with OrgID too.
How can get all data by passing EmpId with one sql statement?
Thanks.
Use a
LEFT JOIN:OrgName will be
nullin the result rows if the FK is null.