假如表名=aaa
select hno,count(hno) as hno_cnt from aaa;
group by hno into cursor abc1)
select b.* ;
from abc a,aaa b;
where a.hno=b.hno and a.hno_cnt>12)
select b.* ;
from abc a,aaa b;
where a.hno=b.hno and a.hno_cnt=1
select hno,count(hno) as hno_cnt from aaa;
group by hno into cursor abc1)
select b.* ;
from abc a,aaa b;
where a.hno=b.hno and a.hno_cnt>12)
select b.* ;
from abc a,aaa b;
where a.hno=b.hno and a.hno_cnt=1
查询1:
select * from test where hno in (select hno from test group by hno having count(*)>=2)查询2:
select * from test where hno not in (select hno from test group by hno having count(*)>=2)