Avatar of Fordraiders
Fordraiders
Flag for United States of America asked on

Order By specific order

Access 2010

Is there a way to tell a query to do an order by in a specifc order ?


SELECT WwgCore.ITEM, WwgCore.SPIN
FROM WwgCore
WHERE (((WwgCore.SPIN)="ST" Or (WwgCore.SPIN)="TP" Or (WwgCore.SPIN)="LS" Or (WwgCore.SPIN)="C3" Or (WwgCore.SPIN)="C4"))
ORDER BY WwgCore.SPIN;

But I want it To return in this order specifically

ST
TP
LS
C3
C4

Thanks
fordraiders
Microsoft Access

Avatar of undefined
Last Comment
Fordraiders

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
peter57r

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dale Fye

No points please.  Either of the methods above will work, but method one is not very flexible( you must change the sort order in the query if you add a [SPIN] value to the query.

I prefer the method provide by peter, although this can result in a bunch of additional tables, if you want to do this for different stuff.  The other advantage of this method is that you can create a form that allows you to change the sort order within the application.
Fordraiders

ASKER
Thanks fyed for additional comments. I like them both.
Your help has saved me hundreds of hours of internet surfing.
fblack61