如何用sql语句查询两个表中完全相同的两条记录
1个回答
2017-09-12
展开全部
如何用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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询