update echinacard.air_merchant k set k.merchant_type = (select trim(merchant_type) from echinacard.test_merchant g where g.merchant_id = k.merchant_id and g.merchant_type = '103') 这句话多吗,为何加了条件修改,可把全部的数据都修改了啊
update air_merchant a set merchant_type=(select b.type_id from air_merchant_type b ,test_merchant c where a.merchant_id=c.merchant_id and b.type_big=c.mer_big_type and b.type_name=c.mer_name)
update from air_merchant A set merchant_type =(select c.type_id from air_merchant B,air_merchant_type C where A.merchant_id=B.merchant_id and B.mer_big_type=C.type_big and B.mer_name =C.type_name )
where exists (select 0 from bb where bb.b=aa.b)
set k.merchant_type = (select trim(merchant_type) from echinacard.test_merchant g where g.merchant_id = k.merchant_id and g.merchant_type = '103')
这句话多吗,为何加了条件修改,可把全部的数据都修改了啊
10001774 宁波中国国际旅行社家乐门市部 104
10001940 车奴汽车美容护理店 104
10001879 龙耀迪汽车租赁服务有限公司 104
10002060 港中旅国贸旅行社有限公司 104
10001880 龙耀迪汽车租赁服务有限公司 104
这是表air_merchant
merchant_id mer_big_type mer_name
10001774 104 其他
10001940 104 其他
10001879 104 其他
10002060 104 其他
这是表test_merchant
type_id type_name type_big
108 汽车 104
109 手机 104
110 其他 104
这是表air_merchant_type 表air_merchant中merchant_id与test_merchant中的merchant_id对应,test_merchant中merchant_big_type与air_merchant_type表中type_big对应.mer_name与type_name对应.我想经过这三张表修改air_merchant表中merchant_type 列.merchant_type列的值就是对应air_merchant_type表中type_id列.请问怎么做呢
from air_merchant_type b ,test_merchant c
where a.merchant_id=c.merchant_id and b.type_big=c.mer_big_type and b.type_name=c.mer_name)