【发布时间】:2021-12-20 12:44:54
【问题描述】:
我有以下 json 字段
{
"Covid-19Vaccine Staus": "Not vaccinated (intent to in the future)",
"Date of last vaccine taken": "2021-08-09T00:00:00+04:00",
"If vaccinated, Name of vaccination received": "Other WHO Approved vaccine"
}
我想做的是将关键描述(即 Covid-19 Vaccine Staus)更新为 Covid19VaccineStaus。
在对 mysql 工作台上的字段进行直接更新时,它会生成以下查询,
UPDATE `my_json_table` SET `containerValue` = '{\"Covid19VaccineStaus\": \"Vaccinated\", \"Date of last vaccine taken\": \"2021-07-13T00:00:00+04:00\", \"If vaccinated, Name of vaccination received\": \"Pfizer-BioNTech\"}' WHERE (`id` = '94');
看起来它需要字段的整个值,然后进行更新。
如果我只想更新 Covid19VaccineStatus 键而不输入 json 架构的其他数据点的值,查询应该是什么样子。
【问题讨论】: