-3

我有下表:

Student_ID  Description 
1       0x
2       0x1G800....
3       0x1F800....

Student_ID 1 有空值我如何使用 sql 查询将 student_ID 2 的值复制到 1 中。

4

1 回答 1

2

这就是你要找的全部吗?

Update Student
SET Description = (SELECT Description FROM Student WHERE Student_ID = 2)
WHERE Student_ID = 1

或使用JOIN

UPDATE S 
SET S.Description = S2.Description
FROM Student S JOIN
    Student S2 ON S2.Student_ID = 2
WHERE S.Student_Id = 1

祝你好运。

于 2013-02-05T21:28:37.897 回答