kevin7 Posted December 13, 2007 Share Posted December 13, 2007 SELECT * FROM buyer WHERE state='d' AND (curdate()-date>40) ORDER BY id DESC" I'm making a query, so that it will return all the records less than 40days, but, im not so familiar with MySQL, my query returned error message. my table structure is id, name, phone, email, description, state, date my date format is (YYYY-MM-DD, eg 2007-12-15) can anyone tell me what's wrong with my query? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/81483-solved-retrieve-record-with-date-diff-less-than-40days/ Share on other sites More sharing options...
kevin7 Posted December 13, 2007 Author Share Posted December 13, 2007 oops... i've fixed it... my stupid mistake... thanks for the time! Quote Link to comment https://forums.phpfreaks.com/topic/81483-solved-retrieve-record-with-date-diff-less-than-40days/#findComment-413671 Share on other sites More sharing options...
fenway Posted December 13, 2007 Share Posted December 13, 2007 Please post your solution... I assume you used `date` > CURDATE() - INTERVAL 40 DAY? Quote Link to comment https://forums.phpfreaks.com/topic/81483-solved-retrieve-record-with-date-diff-less-than-40days/#findComment-413817 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.