如何以desc顺序选择列中的相同单词
命名
Apple
Banana
Orange
Apple
Cherry
Cherry
欲望输出
Cherry
Cherry
Apple
Apple
答案 0 :(得分:1)
如果您只想获得重复的名称,可以使用COUNT
/ GROUP BY
/ HAVING
。
SELECT Name
FROM YOUR_TABLE
GROUP BY Name
HAVING COUNT(Name) > 1
ORDER BY Name DESC
答案 1 :(得分:0)
这可以为您提供所需的输出:
SELECT name FROM table
WHERE name IN (SELECT name FROM table
GROUP BY name
HAVING COUNT(name) > 1)
ORDER BY name DESC