如何用sql语句查询两个表中完全相同的两条记录

如题所述

如何用sql语句查询两个表中完全相同的两条记录
select f1,f2,...,fn
from table
group by f1,f2,...,fn
having count(1)>1 查出存在相同的f1,f2,..,fn
想查找出记录则
select t1.* from table t1
join (select f1,f2,...,fn from table group by f1,f2,...,fn having count(1)>1) t2
on t1.f1=t2.f1 and t1.f2=t2.f2 and ... and t1.fn=t2.fn
温馨提示:答案为网友推荐,仅供参考
相似回答