red_flower — 2011-01-14T08:49:01-05:00 — #1
I need to know determine error
SELECT DISTINCT Grade , ID FROM studentgrade ORDER BY Grade DESC
(SELECT count(Grade) FROM studentgrade WHERE ID=109)
r937 — 2011-01-14T08:54:05-05:00 — #2
you can't use an aggregate function like COUNT() in the WHERE clause
you can't use an aggregate function without a GROUP BY clause unless you're counting all rows
what you want to achieve (a rank for a specific row) will require sql that looks like this -- http://www.sitepoint.com/forums/showpost.php?p=4782963&postcount=2
you might also want to send a message to flower.pink19 as it appears you are both working on the same homework assignment
how interesting that both of you seem to have "flower" in your user names...
guelphdad — 2011-01-14T09:45:54-05:00 — #3
You also can't put a WHERE clause after an ORDER BY clause like you have done.