IBM Db2 - The Ultimate Database for Cloud, Analytics & Mobile
(on Z/OS platform) can anyone help with an issue I'm having with order by ..
ordering on a field with values ,'1','F','G' by default returns rows in the order
I can do 'order by ... desc' and it returns
But what will tell DB2 to change the order to sort letters before numbers so that I can get
thanks for any suggestions
This is a perfect place to use CAST:
ORDER BY CAST(COL1 AS CHAR(1) CCSID UNICODE)
Assuming COL1 is your column name of course!
Roy, thank you very much for your reply this works well !
You can add a field with in your select
myfield from tab1 order by case when substr(myfield,1 , 1) between 0 to 9 then 'A' else 'B' end, myfield