Results 1 to 5 of 5

Thread: Sort Problem

  1. #1
    Join Date
    Jun 2005
    Posts
    45

    Unanswered: Sort Problem

    I have a soring problem. For example, when I sort I get the follwoing: Any Idea how to fix this sort???
    102
    11
    11
    1131
    19
    25
    41
    624

    Thanks in Advance

  2. #2
    Join Date
    Oct 2005
    Posts
    178
    These numbers are string. cOnvert them to integer or real numbers then sort

  3. #3
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136
    What's your data type? If it's text it will sort the way you've shown. If it's number, it should sort correctly.

    Or you can check this website out.

    http://office.microsoft.com/en-us/as...71033.aspx#FAQ

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Quote Originally Posted by markwaugh
    I have a soring problem. For example, when I sort I get the follwoing: Any Idea how to fix this sort???
    102
    11
    11
    1131
    19
    25
    41
    624

    Thanks in Advance
    Code:
    SELECT CLng([Field1]) AS LongField1
    FROM Table1
    ORDER BY CLng([Field1]);
    The resulting recordset is:

    LongField1
    11
    11
    19
    25
    41
    102
    624
    1131

    See the CLng() function in the Help for details.

    HTH,

    Sam

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    using an explicit number conversion like cint / clng shoudl od the job, but lets face it it's still a kludge.

    The basic point is that the data type used for storage should match the data itself, anything else is asking for problems later on down the line.

Posting Permissions

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