MySQL tutorial: PERIOD_DIFF [EN]
top of page
CerebroSQL

MySQL: 

PERIOD_DIFF

Syntax:
PERIOD_DIFF(P1,P2)

Returns the number of months between periods P1 and P2. P1 and P2
should be in the format YYMM or YYYYMM. Note that the period arguments
P1 and P2 are not date values.

URL: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html

Example

mysql> SELECT PERIOD_DIFF(200802,200703);
-> 11

bottom of page