Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I have two tables, both looking like

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?

1 Answer

0 votes
by (119k points)

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.name

SET tB.value = tA.value

I recommend his SQL Certification course to learn more such tips and tricks in SQL.

Related questions

0 votes
1 answer
asked Jul 18, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...