How do window functions and the group by clause interact?

笑着哭i 提交于 2020-05-14 18:06:23

问题


I do understand window functions and group by separately.

But what happens when you use both a window function and a group by clause in the same query ?

  • Are the selected rows grouped first, then considered by the window function ?
  • Or does the window function executes first, then the resulting values are grouped by group by ?
  • Something else ?

回答1:


Quote from the manual:

If the query contains any window functions, these functions are evaluated after any grouping, aggregation, and HAVING filtering is performed

emphasis mine



来源:https://stackoverflow.com/questions/37293435/how-do-window-functions-and-the-group-by-clause-interact

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!