|
|
Hi Ian - Thank you for the quick response. With your help I was able to
get the results I wanted.
Thanks again,
Steve
Ian Skinner wrote:
Steve Miller wrote:
> SELECT Members.member_ID, Members.member_FirstName,
Members.member_LastName, Results.results_MemID,
Sum(Results.results_Points) AS Total_Pts
FROM Members INNER JOIN Results ON Members.member_ID =
Results.results_MemID
GROUP BY Members.member_ID
When you use a SQL aggregate function, SUM() in your case, all the
fields in the SELECT clause must either be in an aggregate function OR
the GROUP BY clause. You need to put member_firstName, member_LastName
and resutls_MemID into one of these locations.
Doing this may very well provide different results then what you want
depending exactly on what data you are summing and selecting. Sometimes
you have to have your analysis queries separate from your basic select
queries and then join the results up in the output.
Also be aware that what order you put the fields into the GROUP BY
clause may change the results, again depending on the nature of your data.
This version works:
SELECT results_MemID, Sum(results_Points) AS Total_Pts
FROM Results
GROUP BY results_MemID
All the fields in the SELECT clause, results_memID and results_points,
are either in an aggregate function, SUM() or the GROUP BY clause.
|
|