I have a table where the content
column consists of a JSON object, with an example value:
{"blocks":[{"score":"A"},{"score":"A"},{"score":"B"}]}
What I am trying to do is SELECT
for a string representation of all the scores, so for this example I want:
AAB
I have been able to parse the JSON easily:
SELECT json_extract(content, '$.blocks[*].score') AS scores
Which results in:
["A", "A", "B"]
but for some reason I'm having an issue concatenating that JSON array into a single string (aside from casting it as a string and calling a few replace functions to remove the quotes and brackets). I've tried variations of CONCAT
and GROUP_CONCAT
but have not found a solution.
What is the proper way to concatinate this JSON string into a single string?