Jump to content

Where doesn't work when order by is activated


Akasha
 Share

Recommended Posts

Hello,i'am having a problem with my sql query. I use ASP to read my table.When I use the order by my where part doesn't work anymore.Why is did happining??

rs2.Open "SELECT * FROM Table1 where mesnum >= "& beginmes &" or mesnum <= " & endmes & " order by mesnum desc", conn,1,1

mesnum is my Key Element.When i remove the order by part its working fine, but the data is in the wrond order ( it must be asc in stead of desc)thats why i am using the order by part.

Link to comment
Share on other sites

ORDER BY doesn't have anything to do with the WHERE clause. There is probably something in the endmes variable that is causing the query to fail.
Thnx i checked the query and changed OR into AND and now its working fine :).
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...