I have 3 sets of Data from 3 Database sources. My question is how will I find which records match and which did not? its okay to have Nulls in Master table
Master Table should look something like this (Its OKAY TO HAVE NULLS)
YOUR HELP WILL BE GREATLY APPRECIATED?
;WITH cte AS( SELECT ID, Name, NULL [City], NULL [SSN] FROM tab1 UNION ALL SELECT ID, NULL, City, NULL FROM tab2 UNION ALL SELECT ID, NULL, NULL, SSN FROM tab3 ) SELECT ID, MAX(cte.Name)[Name], MAX(cte.City)[City], MAX(cte.SSN)[SSN] FROM cte GROUP BY ID
answered Feb 02, 2010 at 01:43 AM