sorting alphanumeric

  • How do i sort

    KW 4.1.1

    KW 4

    KW 8.2

    KW 2.5

    KW 8.4

    KW 4.1.2

    into

    KW 4

    KW 4.1.1

    KW 4.1.2

    KW 2.5

    KW 8.2

    KW 8.4

  • I think you need to provide a bit more of an explanation...

    For example, why should 2.5 come after 4.1.2

  • Sorting the way you provided is not possible, since the one with 2.5 clearly doesn't belong there.

    However, if it was just a typo on your part, you can just store the values in a varchar column and sort it with an ORDER BY clause.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply