Back
I have two tables, both looking like
id name value===================1 Joe 222 Derk 30
id name value
===================
1 Joe 22
2 Derk 30
I need to copy the value of value from tableA to tableB based on check name in each table.
Any tips for this UPDATE statement?
You can use the following SQL query if you wish to update table B with the value of value from tableA to tableB based on check name of tables:
UPDATE tableB tB INNER JOIN tableA tA ON tA.name = tB.nameSET tB.value = tA.value
UPDATE tableB tB
INNER JOIN tableA tA
ON tA.name = tB.name
SET tB.value = tA.value
I recommend his SQL Certification course to learn more such tips and tricks in SQL.
31k questions
32.8k answers
501 comments
693 users