dotjoon — 2011-06-28T04:06:04-04:00 — #1
[b]data in myTable1[/b]
<font color='"Blue"'>(ID) name</font>
<font color='"red"'>(3) Jack</font>
I have data in myTable1 like the above.
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.
[b]would be code[/b]
select id, name, CASE WHEN id = '3' THEN 1 ELSE 2 END AS ORDER_KEY
order by ORDER_KEY, id
<font color='"Red"'>(3) Jack</font>
guido2004 — 2011-06-28T04:14:40-04:00 — #2
Why? What happens? An error? Not the expected output (if so, what output do you get) ?
And did you think about adding a 'sticky' column to your table?
dotjoon — 2011-06-28T06:37:10-04:00 — #3
Sorry, I made a mistake. Maybe it was Capital letters and Small letter problems.
Now I got my target result.
Thank you very much, guido2004.