table1
id firstname
-------------
1 Elon
2 Steve
table2
id profession
-------------
1 Entrepreneur
2 Engineer
table3
firstname profession
-------------
1 2
2 1
Need result:
firstname profession
-------------
Elon Engineer
Steve Entrepreneur
How can I select from different tables in one MySQL query? How can I select from different tables in one MySQL query?
This statement should give you the result you needed.
select t1.firstname, t2.profession from table1 t1 join table3 t3 on t1.id=t3.firstname join table2 t2 on t3.profession = t2.profession
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments