WINDOW FUNCTION MAX
description
LEAD() 方法用来计算窗口内的最大值。
1. MAX([DISTINCT | ALL] expression) [OVER (analytic_clause)]
example
计算从第一行到当前行之后一行的最大值
1. select x, property,
2. max(x) over
3. (
4. order by property, x
5. rows between unbounded preceding and 1 following
6. ) as 'local maximum'
7. from int_t where property in ('prime','square');
9. | x | property | local maximum |
10. |---|----------|---------------|
11. | 2 | prime | 3 |
12. | 3 | prime | 5 |
13. | 5 | prime | 7 |
14. | 7 | prime | 7 |
15. | 1 | square | 7 |
16. | 4 | square | 9 |
17. | 9 | square | 9 |
keywords
1. WINDOW,FUNCTION,MAX
