SELECT players.name,batsmen。* FROM batsmen INNER JOIN球员ON players.id = batsmen.player_id WHERE league_id = 13
我将如何做到这一点?我正在使用Rails框架和MySQL。提前谢谢。
答案 0 :(得分:3)
试试这个:
Player.joins(:batsmen).select('players.name, batsmen.*').where('batsmen.league_id = ?', 13)