I am struggling a little with the best way to write complex queries (the use of parentheses, etc) and when to use stored procedures rather than queries when accessing data using my sql server db.
For instance, the following works just fine but can I speed things up if I write it differently?
td.TeamID FROM RunTrng rt INNER JOIN PartData pd ON rt.PartID = pd.PartID JOIN TeamData td ON
pd.TeamID = td.TeamID WHERE rt.TrngDate >= '5/31/2004' AND rt.TrngDate < '6/25/2004' AND pd.Archive = 'N'
AND pd.Grade >= 10 AND pd.Grade <= 12 AND pd.Gender = 'M' AND pd.TeamID <> 86 AND td.Show_Stdgs = 'Y'
ORDER BY td.TeamID, rt.PartID
I would appreciate any help I can get and any explanations that you would supply with your response.