Return to Snippet

Revision: 41323
at February 16, 2011 08:20 by dotNetkow


Initial Code
SELECT Name
FROM People
WHERE Name in ('Bob', 'Mary', 'Joe')
ORDER BY
  CASE Name
  WHEN 'Mary' THEN 1
  WHEN 'Joe' THEN 2
  WHEN 'Bob' THEN 3  
  END

Initial URL

                                

Initial Description
Similar to "FIND_IN_SET" from MySQL.

Initial Title
Specify order of rows returned in MS SQL Server

Initial Tags
sql, server

Initial Language
SQL