Re: Counting booleans in GROUP BY sections

Поиск
Список
Период
Сортировка
Искать
От
David G. Johnston
Тема
Re: Counting booleans in GROUP BY sections
Дата
Msg-id
CAKFQuwaZD_L5_BdELtXHpPekZGBPnKJbbKK5zS6zgPHmRTTzQg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Counting booleans in GROUP BY sections Alexander Farber <alexander.farber@gmail.com>
Re: Counting booleans in GROUP BY sections Adrian Klaver <adrian.klaver@aklaver.com>
Re: Counting booleans in GROUP BY sections Alexander Farber <alexander.farber@gmail.com>
Re: Counting booleans in GROUP BY sections Adrian Klaver <adrian.klaver@aklaver.com>
Re: Counting booleans in GROUP BY sections Alexander Farber <alexander.farber@gmail.com>
Re: Counting booleans in GROUP BY sections Adrian Klaver <adrian.klaver@aklaver.com>
Re: Counting booleans in GROUP BY sections "David G. Johnston" <david.g.johnston@gmail.com>
On Fri, Nov 29, 2019 at 12:48 PM Alexander Farber <alexander.farber@gmail.com> wrote:

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, you need to decide whether you want to output GROUPS (in which case any detail more specific than your desired group needs to be aggregated) or NOT (in which case you can probably use WINDOW functions to accomplish your goal - count(...) OVER (PARTITION BY <the level of grouping you desire knowledge about - year month it seems in this case>))

David J.
В списке pgsql-general по дате отправления
От: Olivier Gautherot
Дата:
От: Adrian Klaver
Дата:
FAQ