You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have two databases Database1 and Database2
Both databases have a table called acctsub
The values in the table are
CPNYID ACCT SUB USER1 USER2
I want to compare the two databases and see which distinct(CPNYID,ACCT,SUB) values are in Database1 but not in Database2.
I am looking the UNIQUE (CPNYID,ACCT,SUB) Combos that are in one database but not in the other database.
Any help would be highly appreciated.
Thanks
rpresser
unread,
May 22, 2013, 4:18:12 PM5/22/13
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
SELECT CPNYID, ACCT, SUB from Database1.dbo.acctsub AS DB1
WHERE NOT EXISTS (
SELECT * FROM Database2.dbo.acctsub AS DB2
WHERE DB1.CPNYID=DB2.CPNYID AND DB1.ACCT=DB2.ACCT AND DB1.SUB=DB2.SUB)