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



  order by case  Status                                   
           when 'D' then 1                
           when 'A' then 2                
           when 'X' then 3                
           when ' ' then 99               

         end                               

Comments

Popular posts from this blog

AS400 : Add a new line in text in email SNDSMTPEMM

AS400 Display: Radio Button (SNGCHCFLD)

AS400 Display File: Check Box (MLTCHCFLD)