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 2000 Forums
 Transact-SQL (2000)
 non matching records in two tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-01-19 : 09:51:14
Kenn Brown writes "I am new to SQL2000 and making queries. I am trying to figure out how to select the non matching records from two tables. They both have a common identity number field, name, and the usual stuff. I can select and view the records that match but how do I reverse this. All previous attempts have given me hundreds of thousands of records and I know there are only 31642 total records in the one table.

Any help would be appreciated."

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2004-01-19 : 10:13:15
SELECT ChildTable.Key1 FROM ChildTable
LEFT JOIN ParentTable ON ParentTable.Key1 = ChildTable.Key1
WHERE ParentTable.Key1 IS NULL
GROUP BY ChildTable.Key1 ORDER BY 1
Go to Top of Page
   

- Advertisement -