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. Link to comment https://forums.phpfreaks.com/topic/61410-solved-mysql-select-using-between-112000-and-112004/ 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? Link to comment https://forums.phpfreaks.com/topic/61410-solved-mysql-select-using-between-112000-and-112004/#findComment-305620 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. Link to comment https://forums.phpfreaks.com/topic/61410-solved-mysql-select-using-between-112000-and-112004/#findComment-305623 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. Link to comment https://forums.phpfreaks.com/topic/61410-solved-mysql-select-using-between-112000-and-112004/#findComment-305914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.