SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: sort

  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile sort

    hello this my first message to all:
    how can sort the id's:

    i have Id's like:
    TSR1
    TSR2
    TSR3
    TSR33
    TSR34
    TSR45 in my database(ms-access)

    when i display in form :

    it sort like this:

    TSR1
    TSR2
    TSR3
    TSR31
    TSR32
    TSR33
    TSR4
    TSR41
    TSR42

    but i want to display this id like this:

    TSR1
    TSR2
    TSR3
    TSR4
    TSR5
    .
    .
    TSR20
    TSR22
    .
    .
    TSR30
    TSR31
    ..
    TSR231

    please help me regarding this.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,263
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    ORDER BY 0+substring(id,4)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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