![](/img/trans.png)
[英]SQL query to only return the rows that have the highest value in a certain column
[英]SQL Select top 3 rows with highest value in a certain column
使用TOP
不適用於MySQL,因為那是SQL Server(或Access)語法。 您可能想要在這里LIMIT
:
SELECT *
FROM yourTable
ORDER BY Likes DESC
LIMIT 3;
我們還可以使用:
LIMIT 3, OFFSET 0; -- three records with no offset
LIMIT 0, 3 -- same as above
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.