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

推荐订阅源

D
DataBreaches.Net
罗磊的独立博客
M
MIT News - Artificial intelligence
G
Google Developers Blog
V
V2EX
D
Docker
博客园_首页
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
WordPress大学
WordPress大学
T
Tailwind CSS Blog
博客园 - 司徒正美
J
Java Code Geeks
L
LangChain Blog
博客园 - 三生石上(FineUI控件)
B
Blog RSS Feed
博客园 - 【当耐特】
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 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);