I'm trying to refine a query that I am currently using:
SELECT `puid`,
COUNT(DISTINCT `droid_v`) AS DROID,
COUNT(DISTINCT `sig_v`) AS sig,
SUM(NoExt) AS hits
FROM temp
GROUP BY `puid`
And I need to get it to only count droid_v where droid_V is greater than 0. Is it possible to condition the count in this way? At the moment, it is counting zero values as countable, and I can't really change the zeros to null values.
I do not need to know the count value for droid_V = 0, I only need to count it if it has a number greater than 0. That number will always be either 0, 1, 2, 3, or 4.
I have tried:
SELECT `puid`,
COUNT(DISTINCT CASE WHEN `droid_v`