SQL Server Performance Forum – Threads Archive
Records – help is needed!
Hello, guys. My records (but not all) are the same with the exception of int1 (int1 are 1,2,3,4). To get the latest records, I use the statement like this: select * from table1 where exists(select * from table1 as t
where t.column1 = table1.column1 and
t.int1 > table1.int1) But it is not what I need, because it doesn’t also select the records without duplication – where int1 has only one value. Thanks for your help.
Just add
or not exists (select * from table1 as t
where t.column1 = table1.column1 and
t.int1 <> table1.int1)
]]>