ameliabob Posted May 1, 2012 Share Posted May 1, 2012 When I designed a query that looks like this: SELECT * FROM songs WHERE number BETWEEN '1' AND '4' OR number BETWEEN '20' AND '30' AND number BETWEEN '100' AND '110' ORDER BY 'title' ASC title is a field in the songs table. This does not come out sorted the way I wanted. It almost appears to be in the order that the items were put in the table. Do I have to group all of the where conditions? Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2012 Share Posted May 1, 2012 Remove the quotes around title. You're telling it to order records by the word "title", not the title field. Since all records have the same value ("title"), the order is basically undefined. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now