summing values

  • Thread starter Thread starter Miranda
  • Start date Start date
M

Miranda

hi,

i have a query which returns some results like this:

projectID, totalCost
A 34
A 12
A 123
B 3
C 90
C 89

i want to sum the values for whatever projects are returned by this query
i.e.

projectID TotalCost
A 169
B 3
C 179

but when the first query is run different projectID's will be returned each
time so i can't add using
where projectID = A for instance

any help would be appreciated!
thanks
miranda
 
SELECT FirstQuery.ProjectID, Sum(FirstQuery.totalCost)
AS TotalCostSum
FROM FirstQuery
GROUP BY FirstQuery.ProjectID;
 
Back
Top