Join multiple columns from one table to single column from another table

后端 未结 4 1924
Happy的楠姐
Happy的楠姐 2020-12-13 10:55

I\'m trying to learn how to join multiple columns from one table to a single column from another table.

This is my table structure in its simplest form:

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 11:39

    Like this:

    select t1.team_name as team1, t2.team_name as team2, t.team_1, t.team_2
    from trades t
    inner join teams t1 on t1.id = t.team_1
    inner join teams t2 on t2.id = t.team_2;
    

提交回复
热议问题