Jump to content


Photo

Update with a JOIN statement


  • Please log in to reply
2 replies to this topic

#1 hc

hc
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 18 September 2006 - 10:10 PM

Any idea why this returns an error of

ERROR:  syntax error at or near "ims" at character 27

UPDATE imports.menssoccer ims
SET employee_id = uem.id
FROM ims
JOIN users.employees uem ON ims.ssn = uem.tax_id

Any help would be appreciated. Thanks

hc

#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 19 September 2006 - 12:47 AM

I don't think you can give an alias to the table being updated.

How about:
UPDATE imports.menssoccer
SET employee_id = uem.id
FROM users.employees uem
WHERE employee_id = uem.tax_id

#3 hc

hc
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 19 September 2006 - 02:19 AM

that works thank you very much




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users