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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORDER BY is alpha, I need to order by HIGH / MEDIUM / LOW

Status
Not open for further replies.

jsteff

Technical User
May 22, 2003
109
US
I have a good, functioning report where the ORDER BY clause is "ORDER BY PRIORITY". That means is sorts as HIGH then LOW then MEDIUM (which is correct alpha order).

I need to sort the output by PRIORITY but it must be in the sequence of HIGH MEDIUM LOW.

Is there an easy way to do this?

Thanks.


 
ORDER BY IIf(Priority="HIGH",0,IIf(Priority="MEDIUM",1,2))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH,
i have tried your example in several forms BUT it still comes out in alpha order.

Any other suggestions?
 
Ah, well, a report ...
Seems you have some grouping level or sort defined inside the report so the SQL solution doesn't works.
Simply add the calculated field suggested by the order by clause I posted and group on this field.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top