Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hi all i have 2 transaction table.

Status
Not open for further replies.

PeriyurParthi

IS-IT--Management
Joined
Jul 18, 2001
Messages
258
Location
IN
hi all
i have 2 transaction table... code is a common field for both the tables, what i need is a sql query to compare and list out the codes which are not present at the both the tables, replies will be help ful
cheers
parthi
 

The following T-SQL script will identify all the codes in Table1 that are not in Table2 and all in Table2 that are not in Table1. It resturns alll the codes in a singles result set identifyng the source table.

Select *, 'Table1' As TableName
From Table1
Where Code Not In (Select Code From Table2)
Union All
Select *, 'Table2' As TableName
From Table2
Where Code Not In (Select Code From Table1) Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top