Trying to count number professors in dept order by desc
SELECT P.pID FROM Department D, Professor P
WHERE D.dID = P.dI开发者_JS百科D
ORDER count(pID);
Mysql, keeps throwing an error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'count(pID) LIMIT 0, 30' at line 3
ORDER
needs to be ORDER BY
.
You are missing a BY.
The query should be:
SELECT P.pID FROM Department D, Professor P
WHERE D.dID = P.dID
ORDER BY count(pID);
精彩评论