Not sure if I have got the wording correct here, but I have this table:
| name | pets |
|-------|---------------|
| bob | cat, dog |
| steve | cat, parrot |
| dave | dog |
and I want it to become this:
| pet | names |
|--------|--------------|
| dog | bob, dave |
| cat | bob, steve |
| parrot | steve |
2
Answers
Fiddle
You can
unnest
the array and use across join
to regroup:See fiddle.