MySQL select two tables at the same time
I have two tables and want to make a query. I tried to get team AA and team BB's image base on table A.
I used:
SELECT tableA.team1, tableA.team2, tableB.team, tableB.image,
FROM tableA
LEFT JOIN tableB ON tableA.team1=tableB.team
The result only display imageA on the column. Are there any ways to select imageA and image B without using the second query? I appreciate any helps! Thanks a lot!
My table structure are:
table A
team1 team2
------------
AA BB
开发者_JS百科
table B
team image
-------------
AA imagaA
BB imageB
That would be something like:
SELECT tableA.team1, tableA.team2, tableB.team, tableB.image, tb.image
FROM tableA
LEFT JOIN tableB ON tableA.team1=tableB.team
LEFT JOIN tableB tb ON tableA.team2=tb.team
精彩评论