码迷,mamicode.com
首页 > 其他好文 > 详细

两表(多表)关联update的写法 .

时间:2014-06-27 22:57:44      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:blog   http   java   width   art   os   

原文:两表(多表)关联update的写法 .

关于两表关联的update,可以把SQL写成了在SQL Server下面的特有形式,但是这种语法在Oracle下面是行不通的

   update customers a
   set    city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
   where  exists (select 1
                  from   tmp_cust_city b
                  where  b.customer_id=a.customer_id
                 )

   -- update 超过2个值
   update customers a 
   set    (city_name,customer_type)=(select b.city_name,b.customer_type
                                     from   tmp_cust_city b
                                     where  b.customer_id=a.customer_id)
   where  exists (select 1
                  from   tmp_cust_city b
                  where  b.customer_id=a.customer_id
                 )

-

资料引用:http://www.knowsky.com/347147.html

两表(多表)关联update的写法 .,布布扣,bubuko.com

两表(多表)关联update的写法 .

标签:blog   http   java   width   art   os   

原文地址:http://www.cnblogs.com/lonelyxmas/p/3811050.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!