2020-07-10
閱讀量:
1051
MySQL開窗函數(shù)
開窗函數(shù)格式為 函數(shù)(字段) over(partition by 要分區(qū)的字段名 order by 要排序的字段名 asc/desc 滑動窗口)
滑動窗口格式為between frame_start and frame_end 即between ..1. and 2... 形式
其中1和2的代碼為以下幾種:
current row 邊界是當前行,一般和其他范圍關鍵字一起使用
unbounded preceding 邊界是分區(qū)中的第一行
unbounded following邊界是分區(qū)中的最后一行
expr preceding 邊界是當前行減去expr的值
expr following 邊界是當前行加上expr的值






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
1條評論