I have data in myTable1 like the above.Code:data in myTable1 (ID) name (1) Tom (2) Jane (3) Jack (4) Mary (5) Ted
Because (3) Jack is a kind of sticky, I like to make jack comes first or last.
The following would-be code is one of my trials.
But it seems to be not work as I want.
Code:would be code select id, name, CASE WHEN id = '3' THEN 1 ELSE 2 END AS ORDER_KEY from myTable1 order by ORDER_KEY, id target result (3) Jack (1) Tom (2) Jane (4) Mary (5) Ted



Reply With Quote



Bookmarks