我正在尝试按大多数点排序表,然后按字母顺序排列。我已经走到了这一步,但我无法让它发挥作用。
SELECT category FROM (
SELECT category from table ORDER BY points DESC LIMIT 35
) a
ORDER a.by category LIKE 'A%'
我做错了什么?
谢谢
答案 0 :(得分:2)
您需要使用WHERE
:
SELECT a.category
FROM (
SELECT category FROM `table` ORDER BY points DESC LIMIT 35) a
WHERE a.category LIKE 'A%'
ORDER BY a.category
<强>更新强>
OP想要一个简单的ORDER BY
SELECT a.category
FROM (
SELECT category FROM `table` ORDER BY points DESC LIMIT 35) a
ORDER BY a.category
答案 1 :(得分:0)
您可以在一个ORDER BY
SELECT category FROM table
ORDER BY points DESC, category ASC
LIMIT 35
如果您打算按字母顺序排列前35位(不考虑排名前35位的排名),您可以这样做:
SELECT a.category
FROM
(SELECT category FROM table ORDER BY points LIMIT 35) AS a
ORDER BY a.category ASC
答案 2 :(得分:0)
您只需要以下内容:
SELECT category FROM table ORDER BY points DESC, category ASC Limit 35