create testtable(a int,b int,c int)select a.columnname,a.sumtotal
from
(
select count(*) as sumtotal,'a' as columnname from testtable
where a is null
union
select count(*) as sumtotal,'b' as columnname from testtable
where b is null
union
select count(*) as sumtotal,'c' as columnname from testtable
where c is null
) a
order by a.sumtotal如表列数不确定,改为动态SQL即可(列从系统表中动态取)
from
(
select count(*) as sumtotal,'a' as columnname from testtable
where a is null
union
select count(*) as sumtotal,'b' as columnname from testtable
where b is null
union
select count(*) as sumtotal,'c' as columnname from testtable
where c is null
) a
order by a.sumtotal如表列数不确定,改为动态SQL即可(列从系统表中动态取)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货