1

I have two tables that I need to import data from where both share a column with the same data. However one table has a value in it that needs to be copied to another. I need an sql command that works like below:

Update table1 contenttitle with table2 title where table2 id equals table1 contentid

So essentially it is copied the values from table2 title and inputting them in table 1 contenttitle where the values in table2 id and table1 contentid are equal.

3 Answers 3

2
update table1 
join table2 on table1.contentid = table2.id
set contenttitle = table2.title
0
Update table1
set table1.content1=table2.content2
from table2 join table1 on table2.contentid=table1.contentid
0
update table1
set table1.contenttitle = table2.title
FROM table1 
inner join table2 on table1.id= table2.id
1
  • While this may answer the question it's better to add some description on how this answer may help to solve the issue. Please read How do I write a good answer to know more. Commented Jun 15, 2018 at 11:27

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.