Home Forums SQL Server 2005 T-SQL (SS2K5) How to Sort SQL Results in Your Own Preferred Order RE: How to Sort SQL Results in Your Own Preferred Order

  • order by (case FirstName when 'Select All' then 1 else 0 end) asc

    What I want is the "Select All' appears in the first result.

    Then wouldn't you want:

    order by (case FirstName when 'Select All' then 0 else 1 end) asc

    🙂

    Of course that may not help with this specific query because I think you can't reference an "alias" in an ORDER BY with a UNION.

    Scott Pletcher, SQL Server MVP 2008-2010