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 Quote 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) Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.