简单sql,送分交友型
表A:
studentId
表B:
studentId1,studentId2
要求A.studentId=B.studentId1时, 将 相应的B.studentId2的值设给A.studentId
实现这个功能的比较好的sql代码
------解决方案--------------------update A
set A.studentId=B.studentId2
from A,B
where A.studentId=B.studentId1
------解决方案--------------------啥叫送分交友型,笑死我了。
update a
set a.studentId1 = b.studentId2
from a
join b on A.studentId=B.studentId1
------解决方案--------------------update A
set A.studentId=B.studentId2
FROM A INNER JOIN B ON A.studentId=B.studentId1
------解决方案--------------------update a
set studentId = b.studentId2
from a,b
A.studentId=B.studentId1
------解决方案--------------------update A
set A.studentId=B.studentId2
from A,B
where A.studentId=B.studentId1
------解决方案--------------------update A
set A.studentId=B.studentId2
FROM A INNER JOIN B ON A.studentId=B.studentId1
那我等着接分好了。呵呵
------解决方案--------------------update a
set a.studentId1 = b.studentId2
from a
join b on A.studentId=B.studentId1