List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:January 23 2006 3:49pm
Subject:Re: Comparing 2 Tables
View as plain text  
Andrew,

 >I need to update a table without disturing the recordset however there are
 >or could be some overlaps with data is there a way I can compare id fro
 >the same 2 tables, one new one old?

Here's one way...

SELECT 
  MIN(TableName) as TableName, id
FROM (
  SELECT 'Table a' as TableName, a.id
  FROM a
  UNION ALL
  SELECT 'Table b' as TableName, b.id
  FROM b
) AS tmp
GROUP BY id
HAVING COUNT(*) = 1
ORDER BY id;

PB



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.22/238 - Release Date: 1/23/2006

Thread
assigning variable without printing result?Jacek Becla22 Jan
  • Re: assigning variable without printing result?Gleb Paharenko23 Jan
    • Comparing 2 TablesAM COMS23 Jan
      • Re: Comparing 2 TablesSGreen23 Jan
      • Re: Comparing 2 TablesPeter Brawley23 Jan