Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order By letters and numbers

Status
Not open for further replies.

wayneglossop

Programmer
Aug 13, 2006
2
GB
Hi.

I have sporting league tables which have the divisions as 'P' (Premier), '1', '2' and '3'.

I have this code installed: ORDER BY division ASC, which puts 'P' at the bottom of the list.

How can I put 'P' at the top? (then 1,2,3).

Thanks,

Wayne.
 
Code:
order by (case when division='P' then 0 else 1 end), division

that says to order by division P at the top and then all the other divisions below that. you then need division again so that the 1,2,3 divisions order within their order as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top