Friday, June 21, 2013

6/21/2013

Compare 2 tables. Get all values from table1 and not in table2 (outliers)

(select distinct column1 from Table1)
except
(select distinct column2 from Table2)

or

Select Table1.*
From Table1 LEFT JOIN Table2
     ON Table1.column1 = Table2.column2
Where Table2.column2 IS NULL

or

SELECT *
FROM table1
WHERE column1 not in (SELECT column2 FROM table2)

No comments:

Post a Comment