Results 1 to 2 of 2

Thread: SQL - Sorting with Alpha - numeric character

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    SQL - Sorting with Alpha - numeric character

    Hi All Experts,

    How to sort the field which contains alphanumeric character.
    Suppose my the field data as below.

    1,10,1a,2a,200a,a20,3,5

    I want my output is 1,1a,10,2a,200a,3,5,a20

    Is that possible to achieve?

    Thanks in advance :-)
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: SQL - Sorting with Alpha - numeric character

    It's possible, but you'd have to break the value into its alpha and numeric parts in your SQL code and then sort on both. If possible, a better option might be to store the alpha and numeric portions in separate columns. You can then simply sort on those two columns.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width