[dba-SQLServer] How do I create an update query with a join

Francisco Tapia fhtapia at gmail.com
Fri Apr 1 14:10:23 CST 2005


sounds like you wanna do it this way:
UPDATE tblCorrections05
SET tblCorrections05.PassFCATMathdt = Null
FROM tblCorrections05
INNER join tblCorrections05 ON (tblMembership05.StudentID = 
tblCorrections05.SID)
AND (tblMembership05.SchlNo = tblCorrections05.SchlEnrl)
AND (tblMembership05.DistrictNo = tblCorrections05.DistEnrl)
WHERE (((tblMembership05.MMetGradflg)="1"))

On Apr 1, 2005 12:04 PM, Klos, Susan <Susan.Klos at fldoe.org> wrote:
> 
> I tried this (which I got from Access):
> 
> UPDATE tblMembership05
> 
> INNER join tblCorrections05
> 
> ON (tblMembership05.StudentID = tblCorrections05.SID)
> 
> AND (tblMembership05.SchlNo = tblCorrections05.SchlEnrl)
> 
> AND (tblMembership05.DistrictNo = tblCorrections05.DistEnrl)
> 
> SET tblCorrections05.PassFCATMathdt = Null
> 
> WHERE (((tblMembership05.MMetGradflg)="1"))
> 
> I get this error:
> 
> Server: Msg 156, Level 15, State 1, Line 2
> 
> Incorrect syntax near the keyword 'INNER'.
> 
> Server: Msg 170, Level 15, State 1, Line 7
> 
> Line 7: Incorrect syntax near 'tblMembership05'.
> 
> Any help will be greatly appreciated.
> 
> Susan Klos
> 
> Senior Database Analyst
> 
> Evaluation and Reporting
> 
> Florida Department of Education
> 
> 850-245-0708
> 
> sc 205-0708
> 
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 


-- 
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...



More information about the dba-SQLServer mailing list