GROUP BY
goes after WHERE
SELECT Department, COUNT(*) AS CountByTechAndMP
FROM Course
WHERE MPCategory IS NOT NULL AND Technical = true
GROUP BY Department
题
Ok so here my code.
SELECT Department, COUNT(*) AS CountByTechAndMP
FROM Course
GROUP BY Department
WHERE MPCategory IS NOT NULL AND Technical = true;
I have been trying to fool with it but I just can't seem to get it. I feel like it is something easy that I am just missing.
解决方案
GROUP BY
goes after WHERE
SELECT Department, COUNT(*) AS CountByTechAndMP
FROM Course
WHERE MPCategory IS NOT NULL AND Technical = true
GROUP BY Department