I have data coming from multiple sources and I need to display whether it is common or not common.
select a.name,b.email, c.email, case when a.[email] is not null then 'common' else 'not common' end as 'records_status_a&b' from table1 full join table2 on a.email=b.email
The above code works fine if there are only 2 tables , If I add 3 or more tables then data gets changed and I get wrong output.
Also I don’t want to create separate queries and I want to do this in a single query.
select a.name,b.email, c.email, case when a.[email] is not null then 'common' else 'not common' end as 'records_status_a&b' from table1 full join table2 on a.email=b.email full join table3 on a.email=c.email
The last join is giving wrong results
Error is b.email filed will show more nulls than expected.
I’m using full join as I want to get all records