I have my table like this
| user_Id | survey |
|---|---|
| 1001 | {"What are you interested in?": "[Games]", "How do you plan to use Gamester?": "[Play games, Watch other people play, Connect with other gamers]" } |
| 1001 | {"What are you interested in?": "[Coupons]", "How do you plan to use Gamester?": "[Watch other people play]" } |
| 1001 | {"What are you interested in?": "[Games]", "How do you plan to use Gamester?": "[Play games]" } |
I want to group by second field How do you plan to use Gamester? And have output like below
| Option | Count |
|---|---|
| Play games | 2 |
| Watch other people play | 2 |
| Connect with other gamers | 1 |
All the examples I found were for String fields and not for array. Tried few thing but not working. Kindly help how can I group on array field values in josonb column and get count.