Reply to Re: Ordering results by order of the "IN' clause
Posted by Alexander Kuznetsov on 07/28/06 15:43
Deane,
instead of
SELECT my_field FROM my_table WHERE my_field IN ('value2', 'value1',
'value3')
try this:
SELECT my_field FROM my_table
join (
select 'value2' c, 1 n
union all
select 'value1', 2
union all
select 'value3', 3
) t
on my_field = t.c
order by t.n