Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Search MySql records Group By Year from DateTime

Hello Friends,

I am working with Mobile Ad networking site for one of my client and I wanted to get the yearly 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 combine records by yearly from date or date time field. You can do this in two ways. Here is the way to achieve this.

GROUP BY YEAR(datetime)
GROUP BY EXTRACT(YEAR FROM datetime)

Let me know if you find any problem.

Thank You!

Share:

No Comments Yet.

Leave a Reply

Your email address will not be published.