我(bill_plans)
在表中添加了一个新的 JSON 数据类型列。现在我想像这样更新bill_plans
列
[{ "cycle": 1, "fee": 1000}, { "cycle": 3, "fee": 2800}, { "cycle": 10, "fee": 10000} ]
我成功创建了该列,并且还能够更新 bill_plans 列。
该表包含bill_cycle
并且fees
也作为现有列,所以我想更新这样的bill_plans
列
[{ "cycle": value from the bill_cycle column, "fee": value from the fees column}, { "cycle": value from the bill_cycle column, "fee": value from the fees column}]
简单的更新查询是这样的
update coaching_class_entries set bill_plans = ('[{"cycle": 1, "fee": 1000}]') where id = 1;
但现在我无法理解如何bill_plans
从表的现有列更新