模板:
UPDATE t2 SET t2.C_date = (select EventTime from t1 where t1.id = t2.id)
where exists (select 1 from t1 where t1.id = t2.id)
实际使用:
UPDATE hc_fee_order_item it SET it.fee_charge =
(
select fo.amount_discounted from hc_fee_order fo
where fo.id = it.fee_order_id and fo.order_name = '流量会员服务'
)
where exists
(
select 1 from hc_fee_order fo
where fo.id = it.fee_order_id and fo.order_name = '流量会员服务'
);
SQL更新语句示例
本文介绍了一种使用SQL更新语句的方法,通过联表查询的方式更新目标表中的字段值。具体实例为根据订单名称'流量会员服务'来更新费用订单项中的收费金额。

被折叠的 条评论
为什么被折叠?



