I'm assuming (based on your use of EXCEPT) that you're using SQL Server 2005. Consequently, I'd use the ranking functions to achieve this. Note that the common table expression is only used for clarity, since it gets around having to use nested derived tables. Note also, that I've used Attribute1 to represent all common non-key attributes in your tables. In the example, I've given @TableB the highest priority, based on the value assigned to the [Precedence] attribute.-- Declare temp tablesDECLARE @TableA TABLE ([Value] INT, [Yr] INT, Attribute1 VARCHAR(255))DECLARE @TableB TABLE ([Value] INT, [Yr] INT, Attribute1 VARCHAR(255))DECLARE @TableC TABLE ([Value] INT, [Yr] INT, Attribute1 VARCHAR(255))-- Insert test data into temp tablesINSERT INTO @TableA SELECT 100, 2002, 'Table A first row'INSERT INTO @TableA SELECT 100, 2002, 'Table A second row'INSERT INTO @TableA SELECT 200, 2001, 'Table A first row'INSERT INTO @TableB SELECT 100, 2002, 'Table B first row'INSERT INTO @TableB SELECT 300, 2006, 'Table B first row'INSERT INTO @TableC SELECT 400, 2007, 'Table C first row'INSERT INTO @TableC SELECT 300, 2007, 'Table C first row'INSERT INTO @TableC SELECT 100, 2002, 'Table C first row'INSERT INTO @TableC SELECT 100, 2002, 'Table C second row';-- Define CTE to perform union, avoiding nested derived tablesWITH UnionCTE ( [Value], [Yr], [Attribute1], [Precedence] )AS ( SELECT [Value], [Yr], [Attribute1], 1 AS Precedence FROM @TableB UNION ALL SELECT [Value], [Yr], [Attribute1], 2 AS Precedence FROM @TableA UNION ALL SELECT [Value], [Yr], [Attribute1], 3 AS Precedence FROM @TableC )-- Select 'surviving' rows from CTESELECT u.[Value], u.[Yr], u.[Attribute1]FROM ( SELECT [Value], [Yr], [Attribute1], ROW_NUMBER() OVER(PARTITION BY [Value], [Yr] ORDER BY [Precedence]) AS Rank FROM UnionCTE ) AS u WHERE u.Rank = 1
Mark