Re: Order by problem
| From: | Matthew Ballard | Date: | Mon, 11 Dec 2000 00:34:19 +0000 |
| Subject: | Re: Order by problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5140@lists.php.net to get a copy of this message | ||
Currently, it's trying to order by the non-summed field, which would produce strange results. Try this:
Select User,SUM(Correct) as Correct from Picks Group by User ORDER by Correct DESC
Note: I added the alias for sum(correct): as Correct . In the results, reference it by the name Correct, but it should work the way you want it to this way.
Matthew
At 07:00 PM 12/10/2000 -0500, you wrote:
When I run this I get results but not in the order of Correct.Desending (Correct is a field).It sums ok: $resulta = mysql_query("Select User,SUM(Correct)from Picks Group by User ORDER by Correct DESC"); Thanks mpeloso@princeton.edu