Extract elements from JSON array and return them as concatenated string

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Extract elements from JSON array and return them as concatenated string
Дата
Msg-id CAADeyWhC5Tp=mhPU9g2=-q5Y-bU_5_3wGyKLZQrPHscdkG-puA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Extract elements from JSON array and return them as concatenatedstring
Список pgsql-general
Good afternoon,

A PostgreSQL 10.3 table contains JSON data like:

[{"col": 7, "row": 12, "value": 3, "letter": "A"}, {"col": 8, "row": 12, "value": 10, "letter": "B"}, {"col": 9, "row": 12, "value": 1, "letter": "C"}, {"col": 10, "row": 12, "value": 2, "letter": "D"}]

Please suggest, how to extract only the "letter" values and concatenate them to a string like "ABCD"?

I suppose at the end I should use the ARRAY_TO_STRING function, but which JSON function to use for extracting the "letter" values to an array?

I keep looking at https://www.postgresql.org/docs/10/static/functions-json.html but haven't found a good one yet

Thank you
Alex

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: JDBC connectivity issue
Следующее
От: "Ivan E. Panchenko"
Дата:
Сообщение: Re: Extract elements from JSON array and return them as concatenatedstring