Here is a basic example of what I am trying to achieve:
create table #testing (
tab varchar(max), a int, b int, c int )
insert into #testing VALUES ('x',1, 2, 3)
insert into #testing VALUES ('y',1, 2, 3)
insert into #testing VALUES ('x', 4, 5, 6)
select * from #testing
Which will Produce the table:
tab a b c
-----------------------
x 1 2 3
y 1 2 3
x 4 5 6
I then want to compare rows on 'tab' based on the values of a,b,c:
select a,b,c from #testing where tab = 'x'
except
select a,b,c from #testing where tab= 'y'
Which gives me the answer I was expecting:
a b c
------------
4 5 6
However I want to also include the Tab column in my resultset, so I want somthing like this:
Select tab,a,b,c from #testing where ????
(select a,b,c from #testing where tab = 'x'
except
select a,b,c from #testing where tab= 'y')
How would I achieve this?