问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
select decode(count(id),0,null, (count(1)-count(id))/count(id)) from t
id为你要查的列
评论
有用 1
with cte1
as(
select 1 as id union all
select 2 union all
select null union all
select 3 union all
select null
),
cte2
as(
select count(id) as cnt_notnull,count(case when id is null then 0 else null end) as cnt_null
from cte1
)
select *,case when cnt_notnull = 0 then 0 else cnt_null/cnt_notnull *100 end as rate from cte2
cnt_notnull cnt_null rate
3 2 66.6667
评论
有用 0
墨值悬赏