How can use the function SUM() for bit columns in T-SQL?
When I try do it as below:
SELECT SUM(bitColumn) FROM MyTable;
I get the e
SELECT SUM(CAST(bitColumn AS INT)) FROM dbo.MyTable
need to cast into number
or another solution -
SELECT COUNT(*) FROM dbo.MyTable WHERE bitColumn = 1