"Yasaswi Pulavarti" <ya*****@encfor.com> wrote in message
Is it possible to order by specific values in a column. For example a
column may contain values like N, N1, N2, S, S1, S2, R, T. I want to
order by in such a way that all the records with N, N1, or N2 in that
specific column will show up on the top. All the records with S1, S2
values will show up next and finally all records with R and T values
in that specific column will show up. Please give me the select
syntax.
select ...
from ...
order by case left(TABLE.COL, 1)
But in the above, N is first, then R, then S, then T. But the idea is
right. Just replace left(...) with an appropriate formula. You could even
use case end.
select ...
from ...
order by case left(TABLE.COL, 1) when 'N' then 1 when 'S' then 2 end