Thursday, November 17, 2022

sql server - How to count only rows where are non-zero value

In SELECT use this construction with CASE statement:
...
count(*) as rowscount,

sum( case a.costamount when 0 then 0 else 1 end ) as rowscount_nonzero

No comments:

Post a Comment