我的代码:执行此类功能需要哪些功能?
SELECT DISTINCT word
FROM Table
ORDER BY ??? -- number of equal words in descending order
示例:我有以下数据
Word
----
are
are
are
we
we
we
we
is
is
you
期望的输出:(运行查询后)
Word
----
we
are
is
you
答案 0 :(得分:5)
您应该使用GROUP BY
然后使用ORDER
:
SELECT word
FROM Table
GROUP BY Word
ORDER BY COUNT(*) DESC