May 27, 2010 at 8:58 am
May 27, 2010 at 9:00 am
select 1 as myorderBy,name,salary from sometable where manager='Y'
UNION ALL
select 2 as myorderBy,name,salary from sometable where manager='N'
ORDER BY myorderBy,salary
Lowell
May 27, 2010 at 9:03 am
May 27, 2010 at 9:14 am
another way without the UNION:
select
CASE
WHEN manager='Y'
THEN 1
ELSE 2
END
as myorderBy,name,salary
from sometable
ORDER BY myorderBy,salary
Lowell
May 28, 2010 at 12:38 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply