Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help

Status
Not open for further replies.

BobbaBuoy

Instructor
May 25, 2003
75
US
The following query returns 1242645 records when it should return 555:

Code:
SELECT r.FirstName, r.LastName, t.TeamName, g.Grade06, r.Gender, rs.RaceName, ir.Bib 
FROM Roster r INNER JOIN Grades g ON r.RosterID = r.RosterID 
INNER JOIN Teams t ON r.TeamsID = t.TeamsID 
INNER JOIN IndRslts ir ON ir.RosterID = r.RosterID 
INNER JOIN Races rs ON rs.MeetsID = ir.MeetsID 
WHERE ir.MeetsID = 13 AND rs.RacesID = ir.RacesID AND ir.Bib <> 0  
ORDER BY ir.Bib

Can someone tell me what is wrong with it? I am sure there is something I don't know about joins that will jump out at someone who knoes more than me.

Thanks in advance~

Bobba Buoy
Just trying to make sense of it all ...
 
Code:
INNER JOIN Grades g ON r.RosterID = r.RosterID
Should read
Code:
INNER JOIN Grades g ON r.RosterID = [red]g[/red].RosterID

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Duhhhh...

Thanks~

Bobba Buoy
Just trying to make sense of it all ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top