Flying Flying - 1 year ago 62
MySQL Question

Transfering columns between tables that have a relationship

I have two tables:


id, name

11, Harry

12, Wayne

13, Raheem

14, Manuel

15, Thomas


A_id, B_id

11, 14

12, 15

I need all the names for the ids that has the A-B relationships to update.

So, I want table_Names to look like this after the SQL update;

11, Manuel

12, Thomas

13, Raheem

14, Manuel

15, Thomas

How should the mySQL statement look like?

I tried this:

UPDATE table_Names

INNER JOIN table_relationship

ON =

SET table_Names=table_Names


Answer Source
UPDATE table_Names AS t1
INNER JOIN table_relationship AS t2
    ON = t2.A_id
INNER JOIN table_Names t3
    ON t2.B_id =
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download