i a have postgresql query that gets results like this:
id | arrayElements
0 | [0, 2, 1]
1 | [0, 3]
2 | [1]
In the above example the values inside arrayElements means something. I want to split this table based on those arrayElements (to get count).
I want to convert it to:
id | arrayElement
0 | 0
0 | 2
0 | 1
1 | 0
1 | 3
2 | 1
here i'm essentially spliting rows by elements inside arrayElements column. arrayElements column contains string data.
i am using postgresql 14.
my end goal is to get the count per arrayElement which is why i'm separating them into different rows.
how should I solve this?
arrayelements? You state it's an array, but the data looks more like a JSON value.