I would like to combine the following two queries, so that I end up with three columns: RelativePath, field = null/empty string, field with value. I can execute the queries individually, but I’m having trouble combining them.
SELECT RELATIVEPATH, COUNT(RELATIVEPATH) FROM APP
WHERE (FIELD IS NULL) OR (FIELD = '')
GROUP BY (RELATIVEPATH);
SELECT RELATIVEPATH, COUNT(RELATIVEPATH) FROM APP
WHERE (FIELD IS NOT NULL)
GROUP BY (RELATIVEPATH);
You need the
casestatement:This is assuming that the intention of
count(RelativePath)is to count all the rows. If you really want to count the non-NULL values of the column, you would use: