update a
set a.gldkj = b.rydmtj
from ptdta.f03b13 b , ptdta.f0911 a
where a.glco=b.ryco and a.gldct=b.rydctg and a.gldoc=b.rydocg and a.glfy=b.ryfy and a.glpn =b.rypn and glco ='02000' and glctry = 20 and glfy=8 and glpn = 5我在PLSQL中怎么不能跑
请问PL中的SQL应该怎么写啊????????
还有
update (select * from proddta.f0911 where glco = '" & CO & "' and glctry*100+glfy = " & AYear & "and glpn =" & BMonth + & ") a set glexa = (select rnrmk from (select * from proddta.f0413 inner join proddta.f0414 on rmpyid=rnpyid and rmdctm=rndctm and rnrc5 = 1这样一条语句速度太慢 我怎么样优化呢??
谢谢各位大哥了!!!
set a.gldkj = b.rydmtj
from ptdta.f03b13 b , ptdta.f0911 a
where a.glco=b.ryco and a.gldct=b.rydctg and a.gldoc=b.rydocg and a.glfy=b.ryfy and a.glpn =b.rypn and glco ='02000' and glctry = 20 and glfy=8 and glpn = 5我在PLSQL中怎么不能跑
请问PL中的SQL应该怎么写啊????????
还有
update (select * from proddta.f0911 where glco = '" & CO & "' and glctry*100+glfy = " & AYear & "and glpn =" & BMonth + & ") a set glexa = (select rnrmk from (select * from proddta.f0413 inner join proddta.f0414 on rmpyid=rnpyid and rmdctm=rndctm and rnrc5 = 1这样一条语句速度太慢 我怎么样优化呢??
谢谢各位大哥了!!!
解决方案 »
- 急!!!对SQL的问题
- 如何使用T-SQL语句将标识列设为否?
- 使用游标写的查询,求改写成一条SQL语句
- 求一视图写法,望高手指点(在线等)!
- 我想求一条update语句,涉及两个表
- sql server 2005中附加数据库出错
- 一个汇总的问题???
- 我在计算时,如果分母为0就出错了怎么解决?Divide by zero error encountered.
- 怎样用VB将SQL Server中的数据库设为单用户模式?
- 请问:如何将image列数据进行拆分??? Help.......
- MS SQL 行锁定问题~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 一个Alter table column的而为难题
where ...
ID A B
---------- ---------- ----------
1 10 20
2 1 2
3 3 2表tb2及数据如下:
ID A B
---------- ---------- ----------
1 10 20
2 10 20根据表tb2的id更新表tb1对应的a,b的值。update tb1 set (a,b) = (select a,b from tb2 where id = tb1.id) where id in (select distinct id from tb2) ID A B
---------- ---------- ----------
1 10 20
2 10 20
3 3 2
---------------------------------------------------------------------------------------------------------
表tb2及数据如下:
ID A B
---------- ---------- ----------
1 10 20
2 10 20
3 3 2
1 20 40
2 20 40根据ID分组求A,B的和,然后更新表tb1update tb1 set (a,b) = (select sum(a),sum(b) from tb2 where id = tb1.id) where id in (select distinct id from tb2) ID A B
---------- ---------- ----------
1 30 60
2 30 60
--oracle 写法
update a
set a.gldkj = vil((select rydmtj from ptdta.f03b13 where ryco=a.glco and rydctg = a.gldct and rydocg = a.gldoc and ryfy = a.glfy and rypn = a.glpn),a.gldkj)
where glco ='02000' and glctry = 20 and glfy=8 and glpn = 5
set a.gldkj = vil((select rydmtj from ptdta.f03b13 where ryco=a.glco and rydctg = a.gldct and rydocg = a.gldoc and ryfy = a.glfy and rypn = a.glpn),a.gldkj)
where glco ='02000' and glctry = 20 and glfy=8 and glpn = 5
set a.gldkj = vil((select rydmtj from ptdta.f03b13 where ryco=a.glco and rydctg = a.gldct and rydocg = a.gldoc and ryfy = a.glfy and rypn = a.glpn),a.gldkj)
from ptdta.f0911 a
where glco ='02000' and glctry = 20 and glfy=8 and glpn = 5