有沒有更好的方法來做到這一點?連續計數非空值
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