SQL to have one specific record at the top, all others below

Posted by superdario on Stack Overflow See other posts from Stack Overflow or by superdario
Published on 2009-11-09T09:24:02Z Indexed on 2010/05/18 19:30 UTC
Read the original article Hit count: 201

Filed under:
|
|

Hey all,

I am trying to put together a query that will display one specific record (found by the record's primary ID) at the top, and display all other records below it, sorted by date (I have "date_added" as one of the fields in the table, in addition to primary ID).

I could do this with a UNION (first select would locate the record I want, and the other select would display all other records), but I'm wondering if is there perhaps a better way?

I'm using Oracle, by the way.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle