Ordering of records from db

Results 1 to 2 of 2

Thread: Ordering of records from db

  1. #1
    Join Date
    Dec 1969

    Default Ordering of records from db

    Hello,<BR><BR>I have a system that stores a list of files by thier filing index.<BR><BR>The problem I have is with the displaying of the data on the website when the data is ordered by filing index.<BR><BR>I could explain for ages about how the filing indexes are assigned but a few examples will be easier.<BR><BR>A11/1/2 would appear before A9/1 due to the string interpretation of the value.<BR><BR>R17/15/1 comes before R2/10/15. etc etc<BR><BR>I know the easy solution would be to add in zeros<BR><BR>Eg R2/10/15 becomes R02/10/15 but I am not allowed to do it that way.<BR><BR>My question is is there an easy solution so that I can order the files so they display sequentially.

  2. #2
    Join Date
    Dec 1969

    Default RE: Ordering of records from db

    Well, you say yourself that adding zeros is the solution, you can add zeros on the fly in the ORDDER BY clause<BR><BR>an other solution would be to break up the filing index into different parts. You would need to use some string functions to break the filing index into<BR><BR>A<BR>11<BR>1<BR>2<BR><BR>and order by those parts.<BR><BR><BR><BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts