gspica Posted July 23, 2007 Share Posted July 23, 2007 What is the syntax for a mysql select statement to select values between a range of dates. I am trying to use: SELECT * from net5 WHERE Transaction_Date between '6/7/2004' and '11/3/2004' My dates are stored as date_time in the database. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 23, 2007 Share Posted July 23, 2007 RTFM -- the syntax is always there. Your dates should be in the "correct" format, "2004-07-06", etc. Again, rtfm for the possible date formats MySQL expects. Otherwise, your syntax looks fine. Are you getting errors or just not the correct results? Quote Link to comment Share on other sites More sharing options...
gspica Posted July 23, 2007 Author Share Posted July 23, 2007 It works if I change the format to 'Year - Day - Month'. Thanks. Quote Link to comment Share on other sites More sharing options...
gspica Posted July 24, 2007 Author Share Posted July 24, 2007 Correction: It works if I change the format to 'YYYY-MM-DD'. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.