PERIOD_DIFF(P1,P2) returns the number of months between periods P1 and P2. : PERIOD_DIFF « Date Time Functions « MySQL Tutorial






P1 and P2 should be in the format YYMM or YYYYMM.

The period arguments P1 and P2 are not date values.

mysql>
mysql> SELECT PERIOD_DIFF(9803,199803);
+--------------------------+
| PERIOD_DIFF(9803,199803) |
+--------------------------+
|                        0 |
+--------------------------+
1 row in set (0.00 sec)

mysql>








14.34.PERIOD_DIFF
14.34.1.PERIOD_DIFF(P1,P2) returns the number of months between periods P1 and P2.