在delphi中,这个查询怎么写?
sql表:
字段: a b c
2 2 6
4 5 7
2 2 9
3 3 1
3 3 4
我想过滤出
2 2 6
2 2 9
3 3 1
3 3 4
就是字段a、b数值一样,而字段c数值不一样的记录。该如何写?
[解决办法]
select * from 表 t1 where exists (select 1 from (select a,b from 表 group by a,b having count(*) > 1) t2 where t1.a=t2.a and t1.b=t2.b)