Can I sort by given values? Assume that I have column call EMP_ID with range from 1 to 6 then I want to sort by this order (1,3,5,6,4,2). Is there such way to do it easily?
TIA
SELECT [i]columns[/i]
, CASE emp_id
WHEN 1 THEN 21
WHEN 3 THEN 22
WHEN 5 THEN 23
WHEN 6 THEN 24
WHEN 4 THEN 25
ELSE 26 END AS sort
FROM daTable
ORDER
BY sort
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.