返回首页

您好
我有一个表,其中包括一组学生的数据(学生)和一个新的表(申请人)。在这些表中的栏目有:

学生:
Stud_Id
Stud_Name
Institute_Id

申请人:
App_Id
APP_NAME
INST_ID

Stud_Id和App_Id是相同的数据集。我现在打算怎么办,我是要更新申请表,我想插入到INST_ID Institute_Id使用Students.Stud_Id = Applicants.App_Id的。

我已经尝试了一下。但错误出来。我怎样才能解决这个问题?


UPDATE a SET a.Inst_Id = (select s.Institute_Id from Applicants a inner join Students s on a.App_Id = s.Stud_Id)

FROM Applicants a

INNER JOIN Students s ON a.App_Id = s.Stud_Id

回答

评论会员: 时间:2
S