UPDATE price_air_item t1 LEFT JOIN order_item t2 ON t1.ORDER_ITEM_ID = t2.ORDER_ITEM_ID SET t1.BUYER_SHOULD_PAY_AMOUNT = t1.PARTNER_ADJ_TOTAL_AMOUNT WHERE t2.CREATED_REQUEST_TYPE = 'LOTTO-OTA' AND t2.CREATED_BY ='LOTTO-OTA' AND t1.GMT_CREATED = '2017-12-06 14:02:00'
正常的写法是 update table set field ='' where id=(select ***************条件);
例如:
update tb_wd_rpmtplan_base r set r.SHD_RPMT_DATE='2018-03-11' ,r.id='dfasdf'
where r.PROJECT_ID=(
select p.id from tb_zc_project_info p
join tb_wd_loanapply_base lb on lb.project_id=p.id
where lb.APPLY_NUM='RY201803111340200'
);
但是需要join on的语法我尝试很久,都是写不对的,如果我们一定要用到 left join 更新,那么怎么写呢。我总是在网上看到例子了。
语法是:
update table t1 (left) join table2 t2 on ( t1.id=t2.pid )set ti.fiele='' where t2.filed=''
例如:
UPDATE tb_wd_rpmtplan_base r
LEFT JOIN tb_zc_project_info p
ON r.PROJECT_ID=r.ID
set r.SHD_RPMT_DATE='2018-03-11'
where p.id='dfsadf'
--------------------- 作者:Oo当前明月oO 来源:CSDN 原文:https://blog.csdn.net/xun573017588/article/details/79517354?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!