oracle与sql两表关联更新
2013-05-17 19:05
441 查看
oracle与sql两表关联更新
Sql代码 www.2cto.com
update T_DestoryBillsDetail set T_DestoryBillsDetail.wg02=b.wg02,T_DestoryBillsDetail.oldwg10=b.wg10 from T_DestoryBillsDetail a INNER JOIN gdgl b on( a.wg00=b.wg00 and a.atype=b.atype collate Chinese_PRC_90_CI_AI) where a.bid=1211071407220801000
Sql代码
update a set a.wg02=b.wg02,a.oldwg10=b.wg10 from T_DestoryBillsDetail a,gdgl b where a.wg00=b.wg00 and a.atype=b.atype and a.bid=1211071407220801000
Sql代码
update a set a.wg02=b.wg02,a.oldwg10=b.wg10 from T_DestoryBillsDetail a,gdgl b where (a.wg00=b.wg00 and a.atype=b.atype collate Chinese_PRC_90_CI_AI) and a.bid=1211071407220801000
sql 2005或者其他低版本数据库,好像经常报无法解决 equal to 操作中 "Chinese_PRC_CI_AS" 和 "Chinese_PRC_90_CI_AI" 之间的排序规则冲突。
所以加上collate Chinese_PRC_90_CI_AI
oracle 写法
Sql代码
update T_DestoryBillsDetail a set (wg02,oldwg10)=(select wg02,wg10 from gdgl b where a.wg00=b.wg00 and a.atype=b.atype ) where exists (select 1 from gdgl b where b.wg00=a.wg00 and b.atype=a.atype) and a.bid=1211071407220801000
Sql代码 www.2cto.com
update T_DestoryBillsDetail set T_DestoryBillsDetail.wg02=b.wg02,T_DestoryBillsDetail.oldwg10=b.wg10 from T_DestoryBillsDetail a INNER JOIN gdgl b on( a.wg00=b.wg00 and a.atype=b.atype collate Chinese_PRC_90_CI_AI) where a.bid=1211071407220801000
Sql代码
update a set a.wg02=b.wg02,a.oldwg10=b.wg10 from T_DestoryBillsDetail a,gdgl b where a.wg00=b.wg00 and a.atype=b.atype and a.bid=1211071407220801000
Sql代码
update a set a.wg02=b.wg02,a.oldwg10=b.wg10 from T_DestoryBillsDetail a,gdgl b where (a.wg00=b.wg00 and a.atype=b.atype collate Chinese_PRC_90_CI_AI) and a.bid=1211071407220801000
sql 2005或者其他低版本数据库,好像经常报无法解决 equal to 操作中 "Chinese_PRC_CI_AS" 和 "Chinese_PRC_90_CI_AI" 之间的排序规则冲突。
所以加上collate Chinese_PRC_90_CI_AI
oracle 写法
Sql代码
update T_DestoryBillsDetail a set (wg02,oldwg10)=(select wg02,wg10 from gdgl b where a.wg00=b.wg00 and a.atype=b.atype ) where exists (select 1 from gdgl b where b.wg00=a.wg00 and b.atype=a.atype) and a.bid=1211071407220801000
相关文章推荐
- Oracle 2张表关联更新表信息的四个SQL
- Oracle 2张表关联更新表信息的四个SQL
- SQL/Oracle 两表关联更新
- SQL/Oracle 两表关联更新
- Oracle\MS SQL Server Update多表关联更新
- Oracle关联更新语法(T-SQL中的update...from)
- 关于 oracle 多表关联更新的语句写法——仅仅是给自己看的
- oracle的多表关联更新或者插入
- Oracle多表关联更新
- Oracle如何在update中多表关联更新
- SQL关联表更新注意事项
- T-SQL和PL/SQL表关联更新语句的区别
- mysql 两表关联更新sql
- oracle 多表关联更新为什么要加exists
- SQL中的关联更新和关联删除
- oracle sql更新表中多列值,值是从其它表中查询(select)得出
- Sql语句批量更新数据(多表关联)
- Oracle 多表关联更新
- SQL中的关联更新和关联删除
- SQL 根据关联表更新主表中字段数据