开发者

MSSQLCE: Subquery returns parsing error

I've added an ID column (personID) into a table (personList) instead of another field: personPin

Now I need to fill empty foreign key field (seenPersonID) of another table (personAttendances)

UPDATE personAttendances
SET seenPersonID =
(SELECT personID FROM personList WHERE (pers开发者_StackOverflowonAttendances.personPin = personPin))

Why does SQL engine say there is an error parsing the query? Or how can I fill the field on other table?


You need something like

UPDATE personAttendances 
SET seenPersonID = b.personID
FROM personAttendances a
INNER JOIN personList b ON (b.personPin = a.personPin)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜