lqefn写的在oracle和sql server下都能运行。
我写一个在oracle下效率略微高一些的:
select * from 表1 a
where exists(select 1 from 表1 b where a.a = b.a and a.b = b.b and a.c = b.c and a.rowid<>b.rowid)
select * from 表1 as 表a where exists(select a,b,c from 表1 as 表b where 表a.a = 表b.a and 表a.b = 表b.b and 表a.c = 表b.c group by a,b,c having count(*) > 1)
select * from 表1
where (a=c) AND (c=e)
select t1.* from 表1 t1,表1 t2
where t1.主键<>t2.主键//主键需要不相等
and t1.a = t2.a
and t1.c = t2.c
and t1.e = t2.e