PERIOD_DIFF
Calculate the difference between periods. This function returns the number of months between two periods formatted as YYMM or YYYYMM.
Syntax
PERIOD_DIFF(P1,P2)Description
Examples
SELECT PERIOD_DIFF(200802,200703);
+----------------------------+
| PERIOD_DIFF(200802,200703) |
+----------------------------+
| 11 |
+----------------------------+
SELECT PERIOD_DIFF(6902,6803);
+------------------------+
| PERIOD_DIFF(6902,6803) |
+------------------------+
| 11 |
+------------------------+
SELECT PERIOD_DIFF(7002,6803);
+------------------------+
| PERIOD_DIFF(7002,6803) |
+------------------------+
| -1177 |
+------------------------+Last updated
Was this helpful?

