Search MySql records Group By Month from DateTime
I am working with Mobile Ad networking site for one of my client and I wanted to get the monthly records from DateTime field. Actually I am transferring hourly data into different table to reduce load time of reporting page. For this, I need to find the monthly record from date or date time field. You can do this in two ways. Here is the way to achieve this.
GROUP BY MONTH(datetime)
GROUP BY EXTRACT(MONTH FROM datetime)
Let me know if you find any problem.