Re: Getting Results for a month from a date field
| From: | Marek Kilimajer | Date: | Wed, 26 Mar 2003 18:25:13 +0000 |
| Subject: | Re: Getting Results for a month from a date field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141099@lists.php.net to get a copy of this message | ||
|MONTH(date)|
Returns the month for |date|, in the range |1| to |12|:
SELECT * FROM employees WHERE MONTH(hiredate)='$month'
Hunter, Jess wrote:
I have a field named "hiredate" and it is in the typical MySQL format (YYYY-MM-DD) what I am trying to do it be able to create a query that when I put in a particular month it will give me the results regardless of the year the person was hired. This is so I can generate a "anniversary" report to include the names of all the people who were hired in a particular month. Any snippet of code would be helpful. Thanks in advance Jess