Skip to content
Advertisement

Keeps counting all the text values instead of me providing a criteria in SQL

I have very simple query, to count the number of Cause Cancel from the Decision column. It keeps counting all the text values in the column and not just cause cancel.

SELECT Marketics.Case, Count(Marketics.Decision) AS CountOfDecision
FROM Marketics
GROUP BY Marketics.Case
HAVING Count(Marketics.Decision="Cause Cancel");

Advertisement

Answer

I think you want a WHERE clause not a HAVING clause:

SELECT Marketics.Case, Count(Marketics.Decision) AS CountOfDecision
FROM Marketics
WHERE Marketics.Decision = "Cause Cancel";
GROUP BY Marketics.Case
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement