Reputation: 960
I have a table called articles, each article has a rating value. I want to select * from the ten articles with the highest rating.
something along these lines
$query = "SELECT TOP 10 rating FROM articles ORDER BY rating DESC";
I am confused about the TOP 10 part, I would usualy have SELECT * FROM
Upvotes: 4
Views: 8140
Reputation: 1
you can do so by folloing SQL Query
SELECT * FROM article ORDER BY rating DECS LIMIT 10;
Upvotes: -1
Reputation: 1064
Use LIMIT
to do this
$query = "SELECT * FROM articles ORDER BY rating DESC LIMIT 10";
Documentation here
Upvotes: 9