select x,(case when alarmnum>0 then 0 else 1 end) state from (selectx,count(1) alarmnum from A where z=0 group by x) tmp先计算每个台站 报警的次数;再判断报警次数大于0 ,那状态state=0 表示报警,若报警次数=0state=1 正常...
select x from (select x,count(*) xall,(select count(*) from A x1 where z = '1' and x1.x = y.x) x1all from A y group by x) a where xall = x1all这个统计出来的是全部正常的。...