Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE statement help for Access

Status
Not open for further replies.

AdventurGurl

Technical User
Aug 2, 2006
16
US
The following query tells me incorrect syntax near FROM??

UPDATE c SET c.ac_id = b.ac_id
FROM ((Account a
INNER JOIN Account b
ON a.ac_number = b.ac_number)
INNER JOIN scanned_document c
ON a.ac_id = c.ac_id)
WHERE a.ACT_ID IN (59,60,61,62,63,64,65)
AND b.ACT_ID IN (71,72,73,74,75,76,77));

Any ideas? Thanks in advance!
 
try

Code:
UPDATE (c 
INNER JOIN Account b 
ON a.ac_number = b.ac_number)
INNER JOIN scanned_document c 
ON a.ac_id = c.ac_id
SET c.ac_id = b.ac_id 
WHERE a.ACT_ID IN (59,60,61,62,63,64,65)
AND b.ACT_ID IN (71,72,73,74,75,76,77));
 
note that this is ever going to update any records
as this is a self join (the same records)

so if a.ACT_ID IN (59,60,61,62,63,64,65) then b.ACT_ID can not be IN (71,72,73,74,75,76,77)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top