You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
676 B

select * from (select stage,didgroup,sum(zaixiaono) as total from mv_db_sqznqk GROUP BY didgroup,stage union all select '小学' as stage,'在校生' as didgroup, sum(zaixiaono) as total from mv_db_base_student where stage='小学' union all select '初中' as stage,'在校生' as didgroup, sum(zaixiaono) as total from mv_db_base_student where stage='初中' union all select '高中' as stage,'在校生' as didgroup, sum(zaixiaono) as total from mv_db_base_student where stage='高中') t order by case when stage='小学' then 1 when stage='初中' then 2 when stage='高中' then 3 end,case when didgroup='本省外县迁入' then 1 when didgroup='外省迁入' then 2 when didgroup='在校生' then 3 end