MySQL INNER JOIN Alias

前端 未结 2 1422
广开言路
广开言路 2020-12-28 13:34

Does anyone know how I can do an inner joins and alias values within so they won\'t overwrite each other? It might look more clear if you see my code:

    SE         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 14:15

    You'll need to join twice:

    SELECT home.*, away.*, g.network, g.date_start 
    FROM game AS g
    INNER JOIN team AS home
      ON home.importid = g.home
    INNER JOIN team AS away
      ON away.importid = g.away
    ORDER BY g.date_start DESC 
    LIMIT 7
    

提交回复
热议问题