what is the different from this mysql query:
WHERE MONTH(date) = MONTH(CURRENT_DATE)
and this
WHERE date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) AND CURRENT_DATE()
i have tried both but i cant see the different.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For today’s CURRENT_DATE, i.e.: 23-September-2010:
WHERE MONTH(date) = MONTH(CURRENT_DATE)isdatealso in September, i.e. between 01-September and 30-September of any year.WHERE date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) AND CURRENT_DATE()isdatewithin the last 30/31 days. If we’re on 23rd, this will give you an interval between 23-August-2010 and 23-September-2010.