I'm trying to use SEDE to determine how many tag-based badges have been awarded in total. My typical strategy is to sum:
select sum(TagBased)
from Badges
Unfortunately, since TagBased
is a bit value, I get this error:
Operand data type bit is invalid for sum operator.
Out of desperation, I tried count:
select count(TagBased)
from Badges
This counts the number of non-null values, which in this case is identical to count(*)
. So how can a bit value be used in aggregate?