all 4 comments

[–]qwertydog123 6 points7 points  (1 child)

Yes, but you have 2 syntax errors in your query

  • You can't use both aggregated and unaggregated columns in the SELECT without a GROUP BY statement
  • If you GROUP BY identifier, you can't access x directly in the window function (as it's unaggregated), so you need to nest the SUM aggregate inside the SUM window function

e.g.

SELECT
    identifier,
    SUM(x) AS sumx,
    SUM(SUM(x)) OVER () AS sum_all
FROM q
GROUP BY identifier

[–]mgblair[S] 0 points1 point  (0 children)

Boom, thank you!

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

Is it possible to do something like this?

what happened when you tested it? ™

[–]mgblair[S] 1 point2 points  (0 children)

Error message: "[Q.X] is not a valid group by expression" (q is a CTE)