bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL PERIOD_DIFF() Function

Example

SELECT PERIOD_DIFF(201710, 201703);

Definition and Usage

The PERIOD_DIFF() function returns the difference between two periods. The result will be in months.

Note

period1 and period2 should be in the same format.

Syntax

PERIOD_DIFF(
period1
,
period2
)

Parameter Values

ParameterDescription
period1Required. A period. Format: YYMM or YYYYMM
period2Required. Another period. Format: YYMM or YYYYMM

Technical Details

Works in:From MySQL 4.0

Previous

MySQL PERIOD_ADD() Function

Next

MySQL QUARTER() Function