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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single out one record from a Group 1

Status
Not open for further replies.

Silvinho

Programmer
Jul 9, 2001
58
GB
I have a complicated SQL query below which works fine until i want to select just one persons record from a group using the WHERE PlayerID part.

SELECT Sum(Seasons.Appearances) AS SumOfAppearances, Players.Player, Sum(Seasons.League_Goals) AS SumOfLeague_Goals, Sum(Seasons.Cup_Goals) AS SumOfCup_Goals, [SumOfLeague_Goals]+[SumOfCup_Goals] AS Expr1, Players.PlayerID
FROM Players INNER JOIN Seasons ON Players.PlayerID = Seasons.PlayerID
GROUP BY Players.Player, Players.PlayerID, Seasons.PlayerID
WHERE PlayerID = 'MMColParam'

Whenever i try to select an individual record i get this error message.
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Players.PlayerID WHERE PlayerID = '5''.

Can anyone help?
 

Place the Where clause before the Group By clause. It appears you may also need to remove the single quotes around the parameter if the playerid is a number. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums. NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top