Re: Counting booleans in GROUP BY sections

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Counting booleans in GROUP BY sections
Дата
Msg-id 082dc4bf-e668-f091-9d96-9725dd5ddfee@aklaver.com
обсуждение исходный текст
Ответ на Re: Counting booleans in GROUP BY sections  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: Counting booleans in GROUP BY sections
Список 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.klaver@aklaver.com



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Counting booleans in GROUP BY sections
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_basebackup + incremental base backups