Re: JSONB_AGG: aggregate function calls cannot be nested

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: JSONB_AGG: aggregate function calls cannot be nested
Date: 2021-02-20 18:46:25
Message-ID: CAADeyWgGuZkaUDYVULAgO3dnt67fPsnVyP4P6xop1Nr73hxEmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Then I have to split the query in 3 similar ones (with same condition)?

I try:

SELECT
JSONB_AGG(TO_CHAR(finished, 'YYYY-MM-DD')) AS day
FROM words_games
WHERE finished > CURRENT_TIMESTAMP - INTERVAL '2 week'
GROUP BY day
ORDER BY day;
ERROR: aggregate functions are not allowed in GROUP BY
LINE 2: JSONB_AGG(TO_CHAR(finished, 'YYYY-MM-DD')) A...
^

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2021-02-20 19:14:03 Re: JSONB_AGG: aggregate function calls cannot be nested
Previous Message David G. Johnston 2021-02-20 18:43:25 Re: JSONB_AGG: aggregate function calls cannot be nested