View Single Post
Old 01-04-2008, 06:09 AM   #7 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Took a little tweaking, but this works.

Code:
SELECT
    votes.poll_id AS votes_pollid,
    COUNT(item_id) AS count,
    items.* 
FROM       
    votes 
LEFT JOIN 
    items
ON  
    votes.item_id = items.id 
WHERE   
    votes.poll_id = 1 
GROUP BY 
    votes.item_id
ORDER BY 
    count DESC 
LIMIT   
    3;
Thanks!
__________________

Village Idiot is offline  
Reply With Quote