Get difference in years between two dates in MySQL as an integer

后端 未结 9 2060
死守一世寂寞
死守一世寂寞 2020-11-30 10:59

I am trying to calculate how old is a person in a database.
Let\'s suppose to have this simple table:

student(id, birth_date);

Where

9条回答
  •  日久生厌
    2020-11-30 11:41

    Why not use MySQL's FLOOR() function on the output from your second approach? Any fractions will be dropped, giving you the result you want.

提交回复
热议问题