[GENERAL] Issue with json_agg() and ordering

Поиск
Список
Период
Сортировка
Искать
От
Bob Jones
Тема
[GENERAL] Issue with json_agg() and ordering
Дата
Msg-id
CA+HuS5FgxoffWJ8pp4iPySZcaopQ24MGqtqAdyMwdVm7urxhtQ@mail.gmail.com
Список
Дерево обсуждения
[GENERAL] Issue with json_agg() and ordering Bob Jones <r.a.n.d.o.m.d.e.v.4+postgres@gmail.com>
Re: [GENERAL] Issue with json_agg() and ordering "Charles Clavadetscher" <clavadetscher@swisspug.org>
Re: [GENERAL] Issue with json_agg() and ordering Merlin Moncure <mmoncure@gmail.com>
Re: [GENERAL] Issue with json_agg() and ordering Bob Jones <r.a.n.d.o.m.d.e.v.4+postgres@gmail.com>
Hi,


Could anyone give me a few pointers as to how I might resolve the following :

select json_agg(my_table) from (my_table) where foo='test' and bar='f'
order by last_name asc, first_name asc;

ERROR:  column "my_table.last_name" must appear in the GROUP BY clause
or be used in an aggregate function
LINE 1: ...foo='f' order by last_name ...


I suspect It doesn't really matter what my table looks like for the
purposes of the above, but if you need something to go by:

create table my_table(
last_name text,
first name text,
foo text,
bar boolean
);

Thanks !

Bob

В списке pgsql-general по дате отправления
От: scott ribe
Дата:
От: Peter J. Holzer
Дата:
FAQ