select jzbhid, clbhid from table1 group by jzbhid, clbhid having count(*)>1
select table1.* from table1, (select jzbhid,clbhid,count(*) from table1 group by jzbhid,clbhid having count(*)>1) t where table1.jzbhid = t.jzbhid and table1.clbhid = t.clbhid
select distinct jzbhid,clbhid from talbe1
select distinct jzbhid,clbhid from talbe1
select * from talbe1 where jzbhid=clbhid???
这个问题有点含糊,莫非是 select * from table where jzbhid=clbhid
select * from tb group by jzbhid,clbhid having count(*)>1
SELECT A.* FROM TEMP A, (SELECT JZBHID,CLBHID FROM TEMP GROUP BY JZBHID,CLBHID HAVING COUNT(*)>1) T WHERE A.JZBHID=T.JZBHID AND A.CLBHID=T.CLBHID
既然都2个做主键了怎么可能4个字段出现重复记录呢.不考虑主键不主键SELECT * FROM talbe1 GROUP BY jzbhid,clbhid,jzsl,jzdj HAVING COUNT(*) > 1
select jzbhid, clbhid
from table1
group by jzbhid, clbhid
having count(*)>1
(select jzbhid,clbhid,count(*) from table1 group by jzbhid,clbhid having count(*)>1) t
where table1.jzbhid = t.jzbhid and table1.clbhid = t.clbhid
这个问题有点含糊,莫非是 select * from table where jzbhid=clbhid
group by jzbhid,clbhid
having count(*)>1
(SELECT JZBHID,CLBHID FROM TEMP GROUP BY JZBHID,CLBHID HAVING COUNT(*)>1) T
WHERE A.JZBHID=T.JZBHID AND A.CLBHID=T.CLBHID