Query with a custom order

  • Hi !!

    I've a problem: is there any way to choose a custom order of the return query output that is not the same of the table, but should be the same specified in the WHERE clause?

    I mean:

    Col1 | Val 1

    ------------------

    A | 1000

    B | 1100

    C | 120,12

    D | 20

    I need that the order return by the query is:

    Col1 | Val 1

    ------------------

    B | 1100

    A | 1000

    D | 20

    The query could be something like this:

    SELECT Col1, Val 1

    FROM Table

    WHERE Col1 in ('B','A','D')

    ORDER BY <----------:exclamation: ????????

    THANK'S

    Alex

  • Duplicate post

    http://www.sqlservercentral.com/Forums/Topic487765-169-1.aspx

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • SOLVED BY RYAN !!

    Thank's a lot !!

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

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