![](/img/trans.png)
[英]SQL Server - How to bring back and the result of a WHILE BREAK Loop in a function?
[英]How to bring back rows where no result set is found
select replicationTime, count(*) as CountsForNoMatches
from table
where ID IS NULL
Group By ReplicationTime
像这样
select replicationTime, sum(case when ID is null then 1 else 0 end) as CountsForNoMatches
from table
Group By ReplicationTime
或者
select replicationTime, max(case when ID is null then 1 else 0 end) as CountsForNoMatches
from table
Group By ReplicationTime
如果您只想知道该 ReplicationTime 是否存在具有空 ID 的行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.