SQL UPDATE using JOIN


/ Published in: SQL
Save to your folder(s)

SQL update examples using joins


Copy this code and paste it in your HTML
  1. UPDATE c
  2. SET ContactId = ac.contact_id
  3. FROM ATable AS c
  4. INNER JOIN BTable AS ac ON c.Contact = (ac.surname + ', ' + ac.forename)
  5.  
  6. UPDATE c
  7. SET AreaCoordinator = cha.ContactId
  8. FROM dbo.ATable AS c
  9. INNER JOIN dbo.BTable AS cha ON c.County = cha.County

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.