Jump to content

[SOLVED] SELECT TOP 10 rating


rocoso

Recommended Posts

Im trying to get the TOP 10 results of the rating_id. 

 

This sort of works but i get double results from rating_id.

"SELECT rating_id, rating_num FROM ratings GROUP BY rating_id ORDER BY rating_num DESC LIMIT 10"

 

this is the table

CREATE TABLE `ratings` (
`id` int(11) NOT NULL auto_increment,
`rating_id` int(11) NOT NULL,
`rating_num` int(11) NOT NULL,
`IP` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

ID rating_id  rating_num IP

1 345  5 192.168.1.7

 

2 123  3 192.168.1.7

3 345  3 192.168.1.7

 

 

 

 

 

Ive tried variations of counting rating_id, just cant seem to figure it out.    Im new to this...

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.