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
Use LIMIT
to do this
$query = "SELECT * FROM articles ORDER BY rating DESC LIMIT 10";
Documentation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With