数据集1:
--方法1
select aa.zu,aa.shu,aa.guo,aa.pingci from (
select zu,shu,guo,count(*) pingci
from 表名
group by zu,shu,guo
order by zu,shu,guo) aa
where aa.zu<>'1'
or aa.shu<>'a'
or aa.pingci <>1
--方法2
select aa.zu,aa.shu,aa.guo,aa.pingci from (
select zu,shu,guo,count(*) pingci
from 表名
group by zu,shu,guo
order by zu,shu,guo) aa
where not exists (select 1 from (
select zu,shu,guo,count(*) pingci
from 表名
group by zu,shu,guo
order by zu,shu,guo) bb
where aa.zu=bb.zu
and aa.shu=bb.shu
and aa.guo=bb.guo
and bb.zu='1'
and bb.shu='a'
and bb.pingci =1)
数据集2:
select zu,shu,guo,count(*) pingci
from 表名
group by zu,shu,guo
ORDER BY zu,shu asc ,pingci desc