Postgres v12.0
I have a table
| data |
|---|
| {"a": "1", "b": "1"} |
| {"a": "2", "b": "1"} |
And I'd like to retrieve a distinct list of keys and the set of values for each key
| key | values |
|---|---|
| a | [ "1", "2" ] |
| b | [ "1" ] |
Not sure how to formulate a query to achieve those results.