update A set M=A.X, N=A.Y from A,B where A.id=B.id and ...
UPDATE B T1 set T1.M=T1.X,T1.N=T1.Y WHERE EXISTS (SELECT 1 FROM A T2 WHERE T2.ID=T1.ID)
--> 跟A有关系? update B set M=X,N=Y from B where 筛选出来的X,Y
B表中筛选出来的X,Y两列数据插入到B表的M,N两列当中去 ??和A表都没关系呢
A,B两张表 在A表ID和B表ID一一对应的情况下 把B表中筛选出来的X,Y两列数据插入到B表的M,N两列当中去 要保证B表的其他列的数据不会被清空 应该怎么写?update b set b.m = a.x, b.n = a.y from b,a where a.id = b.id
把B表中筛选出来的X,Y两列数据插入到B表的M,N两列当中去 没看懂,是插入到A表中去吧 update A set A.M = (select t2.X from B t2 where A.ID = t2.ID) A.M=(select t2.Y from B t2 where A.ID = t2.ID)
from A,B
where A.id=B.id
and ...
WHERE EXISTS (SELECT 1 FROM A T2 WHERE T2.ID=T1.ID)
update B set M=X,N=Y from B where 筛选出来的X,Y
在A表ID和B表ID一一对应的情况下
把B表中筛选出来的X,Y两列数据插入到B表的M,N两列当中去
要保证B表的其他列的数据不会被清空
应该怎么写?update b
set b.m = a.x,
b.n = a.y
from b,a
where a.id = b.id
没看懂,是插入到A表中去吧
update A set A.M = (select t2.X from B t2 where A.ID = t2.ID)
A.M=(select t2.Y from B t2 where A.ID = t2.ID)
应该是把B表查询的两列数据X,Y插入到A的为空的两列M,NA,B两张表
在A表ID和B表ID一一对应的情况下
把B表中筛选出来的X,Y两列数据插入到A表的M,N两列当中去
要保证B表的其他列的数据不会被清空
应该怎么写?
update A
set A.M = (select t2.X from Bt2 where A.ID = t2.ID) ,
A.N=(select t2.Y from Bt2 where A.ID = t2.ID)