select productno,resid,dosagedetail from demanddetail group by productno,resid,dosagedetail having cound(*)>1
select * from demanddetail group by productno,resid,dosagedetail having count(*)>1
select * from demanddetail a where exists(select productno,resid,dosagedetail from demanddetail b where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail group by productno,resid,dosagedetail having count(*)>1)
select a.* from demanddetail a join( select productno,resid,dosagedetail from demanddetail group by productno,resid,dosagedetail having count(*)>1 )b on a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail
搞得复杂了,简单点: select * from demanddetail a where (select count(*) from demanddetail b where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail)>1
group by productno,resid,dosagedetail
having cound(*)>1
select *
from demanddetail
group by productno,resid,dosagedetail
having count(*)>1
where exists(select productno,resid,dosagedetail from demanddetail b
where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail
group by productno,resid,dosagedetail having count(*)>1)
select a.*
from demanddetail a join(
select productno,resid,dosagedetail
from demanddetail
group by productno,resid,dosagedetail
having count(*)>1
)b on a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail
select * from demanddetail a
where (select count(*) from demanddetail b
where a.productno=b.productno and a.resid=b.resid and a.dosagedetail=b.dosagedetail)>1