Force result order

  • ORDER BY CASE CARAC WHEN 'None' THEN 1 WHEN 'Low' THEN 2 WHEN 'Strong' THEN 3 WHEN 'Extreme' THEN 4 END ASC, PROJ ASC

  • Dave Ballantyne (10/22/2012)


    Why not normalize the CARAC values to a different table , add a 'SortOrder' Column and Bobs you uncle ?

    Yes, or this 🙂

  • Gazareth (10/22/2012)


    Dave Ballantyne (10/22/2012)


    Why not normalize the CARAC values to a different table , add a 'SortOrder' Column and Bobs you uncle ?

    Yes, or this 🙂

    Didnt want to "Do a Celko" 🙂 , but lets do things right eh 🙂



    Clear Sky SQL
    My Blog[/url]

  • Thanks Body's

    Works fine now.

    Regards

    Thanks!

  • Dave Ballantyne (10/22/2012)


    Gazareth (10/22/2012)


    Dave Ballantyne (10/22/2012)


    Why not normalize the CARAC values to a different table , add a 'SortOrder' Column and Bobs you uncle ?

    Yes, or this 🙂

    Didnt want to "Do a Celko" 🙂 , but lets do things right eh 🙂

    A table's typically the way I'd want to do it anyway. If that order by clause had to appear in more than one query or had any more criteria, it'd be straight in a table! 🙂

  • davdam8 (10/22/2012)


    Thanks Body's

    Works fine now.

    Regards

    Thanks!

    No problem, glad it got sorted. If that ordering does have to appear in other queries, look at putting it in a table as Dave suggested.

    You'll find it much easier to maintain 🙂

    Cheers

    Gaz

Viewing 6 posts - 16 through 20 (of 20 total)

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