If you are using SQL Server 2005, then you can use Intersect Key word, which gives you common records.
SELECT column1FROM table1INTERSECTSELECT column1FROM table2
If you want in the output both column1 and column2 from table1 which has common columns1 in both tables.
SELECT column1, column2FROM table1WHERE column1 IN(SELECT column1FROM table1INTERSECTSELECT column1FROM table2)
No comments:
Post a Comment