views:

31

answers:

2

I need to use an order by on a table but keep some special rows on top. The rows that have name='developer' for example.

+1  A: 
ORDER BY CASE WHEN name = 'developer' THEN '0' ELSE name END
Adam Bernier
A: 

Something like this might work for you.

SELECT * FROM table ORDER BY CASE WHEN name = 'developer' THEN 0 ELSE 1 END, name
kevpie