How to select last 6 months from news table using MySQL

前端 未结 6 1884
生来不讨喜
生来不讨喜 2020-12-07 16:22

I am trying to select the last 6 months of entries in a table, I have a column called datetime and this is in a datetime mysql format.

I have seen many ways using in

6条回答
  •  萌比男神i
    2020-12-07 17:07

    You can also use TIMESTAMPDIFF

        TIMESTAMPDIFF(MONTH, your_date_column, now()) <= 6 )
    

提交回复
热议问题