Page 1 of 1

Returning results in the order of 'most results first'

Posted: Tue Dec 06, 2005 12:14 pm
by Grim...
Well, the subject made no sense :?

Anyway, let's say I had a forum, which, in the 'posts' table, lists the text, and the poster id.

I want to see who has made the most posts, so I need to fetch a list of the poster id's, ordered by the amount of times they are in the table.

And that's where my SQL skills fail me. All I can do is

Code: Select all

SELECT * FROM women WHERE attracted_to = 'Grim...' ORDER BY boob_size DESC
:D

Posted: Tue Dec 06, 2005 12:19 pm
by hawleyjr

Code: Select all

SELECT COUNT(ID) as id FROM TABLE GROUP BY USER_ID ORDER BY id DESC

Posted: Tue Dec 06, 2005 12:19 pm
by Burrito
look at the having clause...

Re: Returning results in the order of 'most results first'

Posted: Tue Dec 06, 2005 12:23 pm
by Chris Corbyn
Grim... wrote:

Code: Select all

SELECT * FROM women WHERE attracted_to = 'Grim...' ORDER BY boob_size DESC
:lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:

Posted: Tue Dec 06, 2005 12:32 pm
by Grim...
Ta :)