left join
Hi
I have 2 tables say tabA(col1,col2,col3,AdminID,cotactorid ), tabB(id,RefName)
tabA contains 5 cols out of these 5 cols ,2 cols(AdminID,cotactorid) are reffering the id field of tab B
in my sql query i want to fetch the AdminID,cotactorid and coresponding names of these 2 from tabB
my below sql giving correct refname if both adminid and contactorid are same if not its displaying null for refname.
like if adminid and contactorid are 1 its displaying
1,"Somu",1
if adminid =1 and contactorid are 2 its displaying
1,null,2 but here i want 1,"somu",2,"ramu"
how to do it.
select tabA.AdminID,tabB.RefName ,cotactorid
FROM tabA left JOIN tabB ON tabA.AdminID=tabB.idand cotactorid=tabB.id
|