Results 1 to 3 of 3
Thread: absolute 1st or last order
Jun 28, 2011, 00:06 #1
- Join Date
- Apr 2003
- daejeon, South Korea
- 1 Post(s)
- 0 Thread(s)
absolute 1st or last orderCode:
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.
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