From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Counting booleans in GROUP BY sections |
Date: | 2019-11-29 20:55:26 |
Message-ID: | 082dc4bf-e668-f091-9d96-9725dd5ddfee@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/29/19 11:47 AM, Alexander Farber wrote:
> Thank you Adrian, but -
>
> if I remove GROUP BY mid, then I get the error:
>
> ERROR: 42803: column "words_moves.mid" must appear in the GROUP BY
> clause or be used in an aggregate function
> LINE 18: mid,
> ^
> LOCATION: check_ungrouped_columns_walker, parse_agg.c:1369
Yes because it is a case of opposing forces. When you remove mid from
the GROUP BY you get an single row for each group that has an aggregated
output where you can have count of > 1. In that case the database has
more then one choice for the mid to display and so it throws the error.
To go forward it would help to know what it is you are trying to achieve?
>
> Regards
> Alex
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-11-30 02:34:30 | Re: pg_basebackup + incremental base backups |
Previous Message | David G. Johnston | 2019-11-29 20:51:49 | Re: Counting booleans in GROUP BY sections |