В MySQL 5.7, где JSON_TABLE()
недоступен, типичное решение использует таблицу чисел.
select
d.*,
json_unquote(json_extract(
d.items,
concat('$[', n.i, '].price')
)) price,
json_unquote(json_extract(
d.items,
concat('$[', n.i, '].itemcode')
)) itemcode,
json_unquote(json_extract(
d.items,
concat('$[', n.i, '].itemname')
)) itemname,
json_unquote(json_extract(
d.items,
concat('$[', n.i, '].quantity')
)) quantity
from deals d
inner join (
select 0 i
union all select 1
union all select 2
union all select 3
) n
on n.i < json_length(d.items)
Это может обрабатывать до 4 объектов на массив. Если вам нужно больше, вы можете расширить подзапрос, добавив больше union all
s.