| От | Diway |
|---|---|
| Тема | json and aggregate |
| Дата | |
| Msg-id | 1383596556949-5776903.post@n5.nabble.com обсуждение исходный текст |
| Ответы |
Re: json and aggregate
|
| Список | pgsql-sql |
Hi,
Why is the following query not working ?
select sum((json_array_elements(data)->>'lines')::integer) as test from
test2 where id = 2;
ERROR: set-valued function called in context that cannot accept a set
('data' is obviously a json datatype)
On the other side, this one is OK but I don't like it ;-)
select sum(value) from (select
(json_array_elements(data)->>'lines')::integer as value from test2 where id
= 2) x;
Thanks!
--
View this message in context: http://postgresql.1045698.n5.nabble.com/json-and-aggregate-tp5776903.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера