Skip to main content

Command Palette

Search for a command to run...

Counting Bit (true & false) in SQL

Published
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]