Calculate and return the difference in months between two specified periods.
SELECT PERIOD_DIFF(201710, 201703); |
The PERIOD_DIFF() function computes the difference in months between two periods.
Note: both period1 and period2 must be in the same format.
PERIOD_DIFF(period1, period2) |
Parameter |
Description |
period1 |
Mandatory: A period formatted as YYMM or YYYYMM |
period2 |
Mandatory: Another period formatted as YYMM or YYYYMM |
Works in: |
From MySQL version 4.0 |
Calculate and return the difference in months between two specified periods.
SELECT PERIOD_DIFF(201703, 201803); |
Calculate and provide the difference in months between two specified periods.
SELECT PERIOD_DIFF(1703, 1612); |