Let's say that we have the following
{ "items" :
[
{"id": 1},
{"id": 2},
{"id": 3}
]
}
How can I get the last element from the array in the given json structure? Getting the first one seems not that complicated
SELECT t.column->'items'->0 AS elem
FROM tbl t
WHERE other_column = 20;
Thanks in advance!