SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    order by (numbers) in a varchar column

    I am trying to find a way to order numbers in a varchar column. Right now, with 13 numbers, if you use just a plain sql order by, the numbers do this:

    1
    10
    11
    12
    13
    4
    5
    6
    7
    8
    9

    I would prefer it to go from 1-13

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...order by cast(varchar_column as unsigned)


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
  •