sql update multiple rows with subselect

Several databases support the update ... from syntax, which is fairly clear:

UPDATE  mba
SET     graduation_date = gt.graduation_date
FROM    user_education_mba_school mba
JOIN    graduation_term gt
ON      gt.graduation_term_id = mba.graduation_term_id

If your database doesn't, please clarify which database you are using.


This isn't going to work because you're setting the entire resultset of the subquery

UPDATE user_education_mba_school SET graduation_date = (
  SELECT gt.graduation_date
  FROM user_education_mba_school mba, graduation_term gt
  WHERE gt.graduation_term_id = mba.graduation_term_id
)

This should work (untested)

UPDATE user_education_mba_school mba SET graduation_date = (
  SELECT gt.graduation_date
  FROM graduation_term gt
  WHERE gt.graduation_term_id = mba.graduation_term_id
)