我想将以下查询限制为5个结果。但不仅仅是5个结果。 points
的5个最低值。我怎样才能做到这一点?
$side = "SELECT title, points, submissionid
FROM submission
WHERE points >= '$sidepoints'
ORDER BY points DESC";
编辑:我希望结果按
points
降序排列。 最佳答案
尝试使用另一个查询(子查询)对查询结果进行排序
SELECT * FROM (
SELECT title, points, submissionid
FROM submission
WHERE points >= '$sidepoints'
ORDER BY points ASC
LIMIT 5
) t ORDER BY t.points DESC
关于php - 将查询限制为查询的5个最低值变量的查询为5个最低值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8541546/