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
https://forums.phpfreaks.com/topic/75930-solved-select-top-10-rating/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.