update对于mysql与oracle的区别

oracle中可以执行的一句sql,但是在mysql中不行的

update tms_order too set too.DELIVERY_TYPE = 'CITY' WHERE too.id IN(
	select  o.id from tms_order o
	LEFT JOIN tms_translocation tt on tt.id = o.TO_LOCATION_ID
	LEFT JOIN tms_city tc on tc.id = tt.city_id
	LEFT JOIN tms_translocation ft on ft.id = o.FROM_LOCATOIN_ID
	LEFT JOIN tms_city fc on fc.id = ft.city_id
	where o.CONSIGNER_ID <> 8
	and  tc.id = fc.ID
	and tc.id is not NULL
	and o.TO_LOCATION_ID is not NULL
)

 两个数据库都可以执行的一句sql,要达到的目的和上一句一致

create table tmp as 
select o.id as o_id from tms_order o
LEFT JOIN tms_translocation tt on tt.id = o.TO_LOCATION_ID
LEFT JOIN tms_city tc on tc.id = tt.city_id
LEFT JOIN tms_translocation ft on ft.id = o.FROM_LOCATOIN_ID
LEFT JOIN tms_city fc on fc.id = ft.city_id
where o.CONSIGNER_ID <> 8
and  tc.id <> fc.ID
and tc.id is not NULL
and o.TO_LOCATION_ID is not NULL;
UPDATE tms_order  set DELIVERY_TYPE = 'NYMPHUOUTSIDE' WHERE id IN (select o_id from tmp); 
drop table tmp;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值