惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
J
Java Code Geeks
月光博客
月光博客
博客园_首页
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
B
Blog RSS Feed
博客园 - 聂微东
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Jina AI
Jina AI
S
SegmentFault 最新的问题
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
量子位
Martin Fowler
Martin Fowler
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗

博客园 - 老狐狸

关于Update语句在不同数据库中的差别 出错存储过程 F_GETTABLELID 正则表达式求值 - 老狐狸 - 博客园 创建层次查询 ultrawebgrid - 老狐狸 - 博客园 javascript - 老狐狸 - 博客园 case when用法和and 后加条件 exp/imp导出导入工具的使用 ASP.NET1.1中Grid自定义眉头 asp.net1.0 TreeView asp.net2.0 TreeView 创建记录、数组 关闭远程数据库连接 创建游标 创建新的序列 创建隐式游标 创建临时表
更新表(多表相关联)
老狐狸 · 2006-06-16 · via 博客园 - 老狐狸

update f_shortforest forest
   
set forest.forestquantity = (select (decode(sum(detail.quantity),
                                               
null,
                                               
0,
                                               
sum(detail.quantity)) * 0.6 +
                                       decode(forest.forestquantity,
                                               
null,
                                               
0,
                                               forest.forestquantity) 
* 0.4)
                                  
FROM d_salerplan@tpo       master,
                                       d_salerplandetail
@tpo detail
                                 
where master.sorderid = detail.sorderid
                                   
and forest.estimateyear =
                                       substr(master.ordermonth, 
14)
                                   
and forest.month =
                                       substr(master.ordermonth, 
52)
                                   
and forest.productid = detail.productid
                                 
group by detail.productid)
where exists(select detail.quantity
                                  
FROM d_salerplan@tpo       master,
                                       d_salerplandetail
@tpo detail
                                 
where master.sorderid = detail.sorderid
                                   
and forest.estimateyear =
                                       substr(master.ordermonth, 
14)
                                   
and forest.month =
                                       substr(master.ordermonth, 
52)
                                   
and forest.productid = detail.productid);