有没有更好的方法来做到这一点?连续计数非空值
select count(First)+count(id)+count(Last)+count(Telephone)
from client
where id ="1";
有没有更好的方法来做到这一点?连续计数非空值
select count(First)+count(id)+count(Last)+count(Telephone)
from client
where id ="1";
不知道这是更好,但目的可能更清楚后来有人读它:
select
(case when First is null then 1 else 0 end) +
(case when id is null then 1 else 0 end) +
(case when Last is null then 1 else 0 end) +
(case when Telephone is null then 1 else 0 end)
from client
where id ="1";
你到底想干什么? – theglauber 2012-04-09 19:03:52
获得一行中非空值的计数 – adayzdone 2012-04-09 19:05:22
我也会对行中空值的计数感到满意。 – adayzdone 2012-04-09 19:12:36