MySQL Tutorial/Date Time Functions/PERIOD DIFF

Материал из SQL эксперт
Перейти к: навигация, поиск

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.

The period arguments P1 and P2 are not date values.



   <source lang="sql">

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