问题
For example, I have a table in Oracle db where the values in a column are:
A
B
C
D
I would like to fetch the following output from the table(here, B,C,D are in alphabetical order and A is put to the last):
B
C
D
A
Note: They have a unique key with the column if that helps.
回答1:
Have a case expression in the ORDER BY to put A rows at the end:
order by case when columnname = 'A' then 1 else 0 end, columnname
来源:https://stackoverflow.com/questions/46726626/how-to-get-a-specific-record-from-a-table-as-the-last-record