Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有更好的方法来做到这一点?
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";