有没有办法通过您未在 select 子句中选择的内容来对表格进行排序,例如:
Table Example
Column | Type |
-----------+-----------+
language | character |
percentage | real |
id | integer |
所以我想理想地做这样的事情
SELECT DISTINCT language FROM Example ORDER BY percentage DESC;
但这显然行不通。有没有一种方法可以让我实际按百分比对其进行排序,而无需在 SELECT 子句中实际选择百分比?
这个查询
SELECT DISTINCT language
FROM countrylanguage
ORDER BY percentage DESC;
给出此错误消息:
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ...T DISTINCT language FROM countrylanguage ORDER BY percentage...