Is there a way to order your table by something that you don't select in the select clause such as:
Table Example
Column | Type |
-----------+-----------+
language | character |
percentage | real |
id | integer |
So I want to ideally do something like this
SELECT DISTINCT language FROM Example ORDER BY percentage DESC;
But this obviously doesn't work. Is there a way that I can actually get it to order it by the percentage without actually selecting percentage in the SELECT clause?
This query
SELECT DISTINCT language
FROM countrylanguage
ORDER BY percentage DESC;
gives this error message:
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ...T DISTINCT language FROM countrylanguage ORDER BY percentage...