試圖找出如何將一個或一個case語句的T-SQL或者內部Case語句
我基本上是檢查兩件事情,如果任一個是真實的,只是把他們看成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
以供將來參考,case語句不拆的方式。 CASE什麼時候(...)然後...何時(...)然後...其他...結束; – jtimperley