I want to calculate the average of the last 6 months in MySQL : [calculate the average of the last 6 months in MySQL.][1]


  [1]: https://i.hizliresim.com/z0ZOq9.png

sample code : `select avg(dt.number_of_employees) from (select number_of_employees from my_table order by date desc limit 1,6) dt;`

but did not work. How can I calculate with php?