If you want to order by a column using something other than alphabetical/numeric ordering, you can use case
to specify the order you want.
order by Group
returns:
Group | Count |
---|---|
Not Retired | 6 |
Retired | 4 |
Total | 10 |
order by case group when 'Total' then 1 when 'Retired' then 2 else 3 end
returns:
Group | Count |
---|---|
Total | 10 |
Retired | 4 |
Not Retired | 6 |