Select Query from 3 tables with foreign keys

foreign-key-relationship, sql, sql-server, subquery

Solution

you have specified all the Winner records So that i have used the left join for player and game. But the Overall code works according to the where condition.

Try This,

select w.* from Winner w
left Join Player p on p.ID_player = w.player_FK
left join Game g on g.ID_game = p.Game_FK
where  Game.ID_game = 2

Problem

I Have 3 Tables with foreign keys to each other. I want to write a SQL Server Stored Procedure to select records from one of them. Now, let's suppose that i want all the Winner records referring to the Player records referring to The Game with the ID=2, how can i proceed? Thank you.

Original source