试图弄清楚如何在 T-SQL 的 case 语句中合并 OR
我本质上是在检查两件事,如果其中任何一个是真的,就将它们视为 0 进行计数。
COUNT(Case When (car[Weight] IS null) then 0 else car.CarKey
OR When (car.BinNumber is null) then 0 else car.CarKey
End) as Carkey
也试过了,但语法错误
COUNT(Case When (car[Weight] IS null) then 0
else When (car.BinNumber is null) then 0
else car.CarKey
End) as Carkey