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

Sorting in a query

Status
Not open for further replies.

gscma1

Technical User
Jun 27, 2006
94
GB
I'm sure there is a very simple answer to this but here we go...

if i want all records with location ending "ON" in descending order, what do i put in the sort criteria of my query??

Please help!
 
In 'location' column, for criteria enter:

right(location,2) = "ON"

for sort enter:

descending

in whichever column you want to sort on.

HTH,

Alex
 
That doesnt seem to work, it brings up random records, am i doing something wrong?
i have entered it exactly how you have said
 
And what about explaining exactly (with some input samples and expected result) what you want to do ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The SQL view of the query should look something like
Code:
Select Location, fld1, fld2, ...

From myTable

Where Location LIKE '*ON'

Order By Location DESC
where "Location, fld1, fld2, ..." is a list of the fields that are being returned by the query.
 
Thank you very much Golom, that worked a treat!
 
I have no idea why like "*ON" would work and right(location,2) = "ON" would not. Possibly a data type issue?

I'm glad you got it to work though. Next time I'll post SQL View so there's no room for error.
 
Possibly i made a typo error, thanks for your help though. much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top