首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > PowerDesigner >

多表联系关系的update语句

2012-07-19 
多表关联的update语句ORACLE?UPDATE?多表关联的update语句??--?update?超过2个值???update?customers?a???

多表关联的update语句

ORACLE?UPDATE?多表关联的update语句

??--?update?超过2个值
???update?customers?a???--?使用别名
???set????(city_name,customer_type)=(select?b.city_name,b.customer_type?
?????????????????????????????????????from???tmp_cust_city?b?
?????????????????????????????????????where??b.customer_id=a.customer_id)
???where??exists?(select?1?
??????????????????from???tmp_cust_city?b
??????????????????where??b.customer_id=a.customer_id
?????????????????)

?

-----------------------------------------

MSSql的多表关联的update语句?
例如A表 存在一下字段:
AID A1 A2 A3 A4

B表中存在字段:
BID B1 B2 B3 B4

如果实现用B表的所有字段更新A表中相应的字段,在MS SQL Server里面可以写成:
update A
set A1=B.B1,A2=B.B2,A3=B.B3,A4=B.B4
from A,B
where A.AID=B.BID

热点排行