Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 compare 2 tables and find out what differ

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2009-04-08 : 05:13:38
Hi

I have 2 tables that have simular data in column "countryname", I need to find out what records exsits in table1 and not in table2. How do I do that?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-08 : 05:16:04
SELECT *
FROM Table1 AS t1
LEFT JOIN Table2 AS t2 ON t2.CountryName = t1.CountryName
WHERE t2.CountryName IS NULL


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2009-04-08 : 05:18:23
wow, that was a very fast reply, Thanks Peso!
Go to Top of Page
   

- Advertisement -