linker3000 Posted December 10, 2007 Share Posted December 10, 2007 Hi, I am a relative rookie so bear with me!!! I have been asked to query a client order list and find all all clients within the last 24 months who have purchased 'item x' for at least 3 months and then stopped. Date handling is not my strength so is this easier than I imagine? The alternative is to pull all teh data into a spreadsheet but I would consider that a failure!! Thanks Link to comment https://forums.phpfreaks.com/topic/80992-is-this-easy-to-do/ Share on other sites More sharing options...
themistral Posted December 10, 2007 Share Posted December 10, 2007 Try using the DATESUB function. The WHERE clause would contain something like WHERE date_purchased > DATESUB(NOW(), INTERVAL 2 YEAR) Link to comment https://forums.phpfreaks.com/topic/80992-is-this-easy-to-do/#findComment-410888 Share on other sites More sharing options...
fenway Posted December 10, 2007 Share Posted December 10, 2007 This is easier to read: WHERE date_purchased > NOW() - INTERVAL 2 YEAR Link to comment https://forums.phpfreaks.com/topic/80992-is-this-easy-to-do/#findComment-411098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.