mysql update 的时候使用left join和where语句

来源:互联网 发布:filco 蓝牙mac 编辑:程序博客网 时间:2024/05/17 08:44

在使用update语句的时候我们有时候需要利用left join 关联表,以下是正确操作:
效果,让指定的orderid为1,2,3数据的finish_at字段更新为freports表的created_at字段

UPDATE ordersLEFT JOIN  freportsON freports.order_id = orders.idset orders.finish_at = freports.created_atwhere orders.id in(1,2,3)
0 0
原创粉丝点击