Either of these ORDER BY clauses should work:
ORDER BY
CASE Status
WHEN 'G' THEN 0
WHEN 'D' THEN 1
WHEN 'S' THEN 2
WHEN 'US' THEN 3 END
or
ORDER BY
CHARINDEX('/'+Status+'/','/G/D/S/US/')
Steve Kass
Drew University
[quoted text, click to view] shiva wrote:
>Hi! Guys
>
> i have problem with order by clause.
>
>i have table some T1 with two columns say Itemname and Status
>
>and data like this
>
>ItemName Status
> T1 G
> T2 D
> T3 US
> T4 S
> T5 G
>
>Now i want to show with status like
> G
> D
> S
> US
>
>plz , give solution
>
>