Canman2005 Posted August 13, 2009 Share Posted August 13, 2009 Hi all I have a bunch of records which have a date field `datecreated` next to each one, so for example 2003-09-28 these are dates that products are built (manufactor) I want to do a QUERY which would grab all records that the date of manufactor was between x and y years. So grab all records which have a manufactor date of between 10 and 15 years old Is that possible or should I store the date next to each item? Thanks so much everyone Dave Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted August 13, 2009 Share Posted August 13, 2009 SELECT * FROM tablename WHERE datecreated >= DATE_SUB(CURDATE(), INTERVAL 15 YEAR) AND datecreated <= DATE_SUB(CURDATE(), INTERVAL 10 YEAR) Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 13, 2009 Author Share Posted August 13, 2009 thanks man 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.