I have run the query above for all columns in a massive table (Billion rows) and everything is fine except a couple which are returning 0. How is this possible?
COUNT(DISTINCT)
can return zero under two circumstances. The first is that all the values for the column/expression evaluate to NULL
. The second is that the WHERE
clause (or JOIN
) filters out all rows.
If you have no WHERE
or JOIN
, then the values are all NULL
for <Columnb>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With