Discussion Locked

Sum up one field per duplicates of other

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have 2 tables, ClassCode & Customer. ClassCode has fields RatingClassCode, CustID, & Premium. Customer has CustID and LastName. I have a query that returns duplicate RatingClassCode with matching LastName and associated Premium. A link to the result is here, please look.
http://bbtitusville.com/query.jpg
How can I return a single row for each RatingClassCode w/ matching LastName but SUM up the Premium?
For example 1st row would read:
8820 BrevardCounty $917.00
with the proper SQL statement instead of the 1st 2 rows in my result:
http://bbtitusville.com/query.jpg

2 replies

by john_wills

You need another table, linking RatingClassCode and LastName. However... GROUP BY RatingClassCode & LastName - I'm not quite sure of that, perhaps you have to SELECT RatingClassCode & LastName AS SomeThing and GROUP BY SomeThing. Or have I misunderstood the problem?

This discussion is closed to new replies.