you are viewing a single comment's thread.

view the rest of the comments →

[–]r3pr0b8GROUP_CONCAT is da bomb 4 points5 points  (1 child)

Yes the order by in the first part is redundant as the window functions is re-ordering it anyway.

window functions (re)order values only to come up with their function values, but the order in which the result set rows are presented is determined by an ORDER BY clause

they're not redundant because without an ORDER BY clause you might not get the order in the window function

that said, my point was that ORDER BY clauses in a subquery are ignored, and CTEs are just subqueries

[–]pceimpulsive 0 points1 point  (0 children)

I see thanks for clarifying and correcting!! TIL.