Skip to main content
Code formatted
Source Link
Michael Green
  • 25.1k
  • 13
  • 53
  • 98

According to given sample data there is "Type" which is common in both table


Select B.PERS, T.DESC from BaseTable B right outer Join Testtable T on ( T.type is null or B.Type=T.type or B.Type is null)and T.Grp = 'G1' where T.DESC<>'' order by B.PERS asc

Select B.PERS, T.DESC
from BaseTable B
right outer Join Testtable T 
on ( T.type is null or B.Type=T.type or B.Type is null)
and T.Grp = 'G1' 
where T.DESC<>'' 
order by B.PERS asc

According to given sample data there is "Type" which is common in both table


Select B.PERS, T.DESC from BaseTable B right outer Join Testtable T on ( T.type is null or B.Type=T.type or B.Type is null)and T.Grp = 'G1' where T.DESC<>'' order by B.PERS asc

According to given sample data there is "Type" which is common in both table

Select B.PERS, T.DESC
from BaseTable B
right outer Join Testtable T 
on ( T.type is null or B.Type=T.type or B.Type is null)
and T.Grp = 'G1' 
where T.DESC<>'' 
order by B.PERS asc
Source Link

According to given sample data there is "Type" which is common in both table


Select B.PERS, T.DESC from BaseTable B right outer Join Testtable T on ( T.type is null or B.Type=T.type or B.Type is null)and T.Grp = 'G1' where T.DESC<>'' order by B.PERS asc