select *
from (select ss.*, 1
from (select *
from alarminfo
where isrootalarm = 1
and isacked = 0
and agentname like '%gzzd%'
order by agentname, laststarttime desc, realarmlevel asc) ss
where rownum between 0 and 50
union
select *
from (select a.*,
rank() over(partition by a.agentname order by a.agentname, a.laststarttime desc, a.realarmlevel asc) rn
from alarminfo a
where a.isrootalarm = 1
and isacked = 0
and agentname not like '%gzzd%') temp) t
from (select ss.*, 1
from (select *
from alarminfo
where isrootalarm = 1
and isacked = 0
and agentname like '%gzzd%'
order by agentname, laststarttime desc, realarmlevel asc) ss
where rownum between 0 and 50
union
select *
from (select a.*,
rank() over(partition by a.agentname order by a.agentname, a.laststarttime desc, a.realarmlevel asc) rn
from alarminfo a
where a.isrootalarm = 1
and isacked = 0
and agentname not like '%gzzd%') temp) t
where rownum between 0 and 50
1、把中调A、B网的先查出来,不管好多,有就查出
2、把非中调网的再查出来,按地市分组
3、把2个结果UNION起来。
4、每地市最多显示10条
2、把非中调网的再查出来,按地市分组
3、把2个结果UNION起来。