Counting Bit (true & false) in SQL

·

1 min read

Here is how to count bit in SQL

SELECT Id, count(1) as TotalCount, 
SUM(CASE WHEN Addressed = 1 THEN 1 ELSE 0 END) as AddressedCount 
FROM [dbo].[Alerts]