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 Link to comment https://forums.phpfreaks.com/topic/170113-solved-age-range-based-on-data-of-manufactor/ 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) Link to comment https://forums.phpfreaks.com/topic/170113-solved-age-range-based-on-data-of-manufactor/#findComment-897366 Share on other sites More sharing options...
Canman2005 Posted August 13, 2009 Author Share Posted August 13, 2009 thanks man Link to comment https://forums.phpfreaks.com/topic/170113-solved-age-range-based-on-data-of-manufactor/#findComment-897371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.