[PHP] Re: Sort by bigger count(*)

2001-08-01 Thread Richard Lynch

 I made a query that uses count(*)
 now how can i get the results sorted following the biggest count(*)
result?

select count(*) as score from foo group by y order by score desc

may do the trick...

I often have trouble with aggregates not being allowed where I want them or
not being able to aggregate on all records, but only display a subset (or
vice versa).

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Sort by bigger count(*)

2001-07-31 Thread Andrew Sterling Hanenkamp

Unless you've used GROUP BY you'll only return one row. I think that 
something like

SELECT x, count(y)
FROM table
GROUP BY y
ORDER BY count(y);

Ought to work.

Later,
Sterling

Elias wrote:

 Hello,
 
 I made a query that uses count(*)
 now how can i get the results sorted following the biggest count(*) result?
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]