sql >> Database >  >> RDS >> PostgreSQL

Postgres:JSON-kolom uitvouwen in rijen

select id,
    (details ->> 'json1')::int as json1,
    (details ->> 'json2')::int as json2
from (
    select id, json_array_elements(details) as details
    from things
) s
;
 id | json1 | json2 
----+-------+-------
  1 |   123 |   456
  1 |   124 |   457
  2 |   234 |   567



  1. Hoe laatste record (op voorwaarde) te verwijderen uit een tabel in MySql

  2. Wat is de standaardwaarde van VARCHAR2 in Oracle?

  3. Problemen oplossen Illegale mix van sorteringen fout in mysql

  4. Op één na hoogste waarde uit de tabel van Oracle DB