Mysql 查询JSON对象key为数字的写法

in PHP后端 with 0 comment
select
    `city_id`,
    avg(`custom_price`->'$."1"') as price1,
    count(*) as cnt
FROM
    `orders`
WHERE
    `prov_id` = 12
    and `status` in (3, 11)
    and `city_id` = 12
    and `add_time` > '2021-08-01'
    and JSON_VALID(custom_price)
GROUP BY
    `city_id`
Comments are closed.