登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿铭的博客

城市里一迷途小程序员

 
 
 

日志

 
 
 
 

Oracle Update with Join  

2009-02-25 15:30:03|  分类: SQL |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Those with a SqlServer background will be familiar with the UPDATE .. FROM syntax. 

For example (totally made up)

update employee_bonus
   set bonus = 0
 from employee_bonus b
 inner join employees e on b.employee_id = e.employee_id
 where e.bonus_eligible = 'N'

Those who transitioned from SqlServer to Oracle might find the absence of the UPDATE FROM a significant loss.  The best Oracle alternative that I know of is as follows.

update ( select bonus
           from employee_bonus b
          inner join employees e on b.employee_id = e.employee_id
          where e.bonus_eligible = 'N' ) t
 set t.bonus = 0

Actually, if you look at it, they are very similar.




引文来源  Oracle Update with Join
  评论这张
 
阅读(1346)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018