这需要 MySQL 8.0 支持的 JSON_TABLE() 函数:
mysql> select id, j.tag from mytable
left join json_table(tags, '$[*]' columns( tag varchar(10) path '$' )) j
on true;
+------+------+
| id | tag |
+------+------+
| 1 | a |
| 1 | b |
| 2 | a |
| 2 | b |
| 2 | c |
| 3 | NULL |
+------+------+
mysql> select id, group_concat(j.tag) as tags from mytable
left join json_table(tags, '$[*]' columns( tag varchar(10)
path '$' )) j
on true
group by id;
+------+-------+
| id | tags |
+------+-------+
| 1 | a,b |
| 2 | a,b,c |
| 3 | NULL |
+------+-------+
【讨论】: