AS400 SQL: Custom Sort based on Values
Control the Way SQL sorts the records based on Values in the tables field:
Below piece of SQL statement will let me have control on how the SQL sort the records based on the values in the Status field; apart from SQL sort based on the alphabetic order
Below piece of SQL statement will let me have control on how the SQL sort the records based on the values in the Status field; apart from SQL sort based on the alphabetic order
order by case
Status
when 'D' then 1
when 'A' then 2
when 'X' then 3
when ' ' then 99
end
Comments
Post a Comment