Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
ORDER BY numberofaffectedrows DESC - Please help!
Old 04-07-2007, 12:32 AM ORDER BY numberofaffectedrows DESC - Please help!
Skilled Talker

Posts: 64
Trades: 0
Basically what I'm trying to create is a scoreboard type thing, with people's usernames (withwho in the table) and have it ordered by the number of rows in the database where withwho is their name.
Here's my non-working query

SELECT DISTINCT withwho FROM game_listing ORDER BY COUNT(withwho) DESC

Please help, or if you need more info I'll provide a prompt response - thankyou.
Petsmacker is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-07-2007, 12:50 AM Re: ORDER BY numberofaffectedrows DESC - Please help!
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Try something like:

SELECT DISTINCT withwho, COUNT(*) AS count FROM game_listing ORDER BY count DESC
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-07-2007, 01:05 AM Re: ORDER BY numberofaffectedrows DESC - Please help!
Skilled Talker

Posts: 64
Trades: 0
I tried, no luck, mysql_error says:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/sites/tbhg.co.uk/public_html/leagues.php on line 222
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause


So I turned the ORDER BY into a GROUP BY but:
Can't group on 'count'

Anymore suggestions?
Petsmacker is offline
Reply With Quote
View Public Profile
 
Old 04-07-2007, 01:47 AM Re: ORDER BY numberofaffectedrows DESC - Please help!
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
SELECT withwho, COUNT(*) AS count FROM game_listing GROUP BY withwho ORDER BY count DESC
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-07-2007, 02:19 AM Re: ORDER BY numberofaffectedrows DESC - Please help!
Skilled Talker

Posts: 64
Trades: 0
Fantastic work sir, it works perfectly and has taught me something I can use in future - cheers mate!
Petsmacker is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ORDER BY numberofaffectedrows DESC - Please help!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14969 seconds with 12 queries