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)
精彩评论