Take the 2-minute tour ×

So I have a mapping table of tournaments to teams. All this table has is TeamId and TournamentId.

I have a proc, GetTournamentsByTeam that takes in @TeamId int

Basically I want to get all the tournament records from tblTournament using all the TournamentId's I get from the mapping table where the TeamId = @TeamId.

How would I do this?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

What you want to do is an inner join between the tables.

SELECT     tournament.*
FROM       tblTournament tournament
INNER JOIN tblTournamentTeams tt ON tournament.TournamentId = tt.TournamentId
WHERE      tt.TeamId = @TeamId
share|improve this answer

What you want to do is read any SQL book for beginners. Seriously.

share|improve this answer

Your Answer


