Example Analysis of sliding aggregation in mysql
This article mainly shows you the "sample analysis of sliding aggregation in mysql", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of sliding aggregation in mysql".
Sliding aggregation is the operation of aggregating data within the range of sliding windows sequentially. Unlike cumulative aggregations, sliding aggregations do not count the data from the starting position to the current location.
Here, we take the statistics of the monthly orders of employees in the last three months as an example to introduce sliding aggregation.
The main difference between sliding aggregation and cumulative aggregation solutions is the conditions under which they are connected. The sliding polymerization condition is no longer b.ordermonth DATE_ADD (a.ordermonth, INTERVAL-3 MONTH) AND b.ordermonth DATE_ADD (a.ordermonth, INTERVAL-3 MONTH) AND b.ordermonth = DATE_FORMAT (a.ordermonth,'% Ymuri 01-01') AND b.ordermonth