Re: Order array of char as number
Posted in 1996
Topics: General Discussion
In article <31B2F4E6.6EA8@luminous-chao.com>, Christopher Sharrer <chris@luminous-chao.com> wrote: >Dipl. Ing. Michael Wald T. 06838-866-177 wrote: >> = > >> We have defined a table where every row stands for an article. >> The key-column is a array of char=B4s . Unfortunately, the customer >> is using article-numbers - no problem to transform it in a string. >> However how can we order a select related to the number-value instead o= >f >> alpahbetical order ( 1111 comes before 999 ) >> Thank you for help >> = > >> Michael >> :) > >You have to convert it into a string with the 'using' clause as: > >LET string =3D number USING "&&&&&&" # ONE '&' FOR EACH DIGIT IN THE NUMB= >ER > >This will make stings like "000999" or "001111". These will sort the >way you want. > >BTW, why didn't you just user an 'integer' type column? >-- = > > >Christopher Sharrer >Luminous Chao, Inc. > Keep in mind also that you can add a numeric constant in your SQL statement to accomplish the same thing. For example: SELECT CATALOG_NO + 0, TITLE FROM BOOKS WHERE <<your criteria here>> ORDER BY 1;