merk
merk

Reputation: 1741

ORDER BY a specific row first, then the rest

I have a table where i'd like to have one specific row be the first row returned in the set, and then the rest of the rows in the table can follow.

I tried using a UNION to do this but it acted like i just did a regular select *

Any suggestions on how to accomplish this?

Upvotes: 2

Views: 478

Answers (1)

anon
anon

Reputation:

ORDER BY CASE 
    WHEN somecolumn = somevalue -- whatever identifies that row
THEN 1 ELSE 2 END

Upvotes: 9

Related Questions