My query is:
SELECT DISTINCT LanguageCode
FROM myTable
ORDER BY (CASE WHEN LanguageCode='GB' THEN 0 ELSE 1 END), LanguageCode
The goal is to get languages, but to get GB language first. And I'm getting this error:
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
I have seen the answers to this question: Reason for - ORDER BY items must appear in the select list if SELECT DISTINCT is specified
But I still don't understand why it applies to me (and how to solve it) as I'm only accessing a single column.