How to calculate difference between two dates in months in MySQL

前端 未结 7 1609
眼角桃花
眼角桃花 2020-12-13 15:58

I have two columns in a MySQL table:

  • DateOfService (datetime)
  • BirthDate (date)

I want to run a MySQL query that will provide date diffe

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 16:53

    Try this:

    SELECT DATEDIFF(DateOfService, BirthDate) / 30 as months FROM ...

提交回复
热议问题