0

There are three tables

Email  
ID  
10  
11  
12  

SLA_DATE     
ID    |    Email_ID  
21    |    10  
22    |    11  
23    |    12  

SLA    
ID    |    Email_ID  
33    |    10  
34    |    11  
35    |    12  

I am trying to update the SLA Email_ID from Email.ID to SLA_DATE.ID. So, after updating the SLA, the table should look like

SLA    
ID    |    Email_ID  
33    |    21  
34    |    22  
35    |    23

Below is what i have tried so far..

UPDATE SLA SET 
SLA.Email_ID = SLA_DATE.ID WHERE SLA_DATE.Email_ID = SLA_EMAIL_ID  

2 Answers 2

3
UPDATE s
SET s.Email_ID = d.ID
FROM SLA s
INNER JOIN
SLA_DATE d
    ON d.Email_ID = s.Email_ID
Sign up to request clarification or add additional context in comments.

Comments

0

This should work

Update S SET S.EmailID = D.ID
   From SLA A
   Join SLA_DATE D On D.Email_ID = S.Email_ID

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.