Problem with sum when there are duplicate records in a query on qu

W

Wenjing

One of my query returns the following results
group COST time_spent
Travel 393.75 2.25
AddServices 65 0.5
SiteRequirements 408.75 0.75
Drilling 75 0.25
Drilling 162.5 0.25
Casing 136.25 0.25
SiteRequirements 408.75 0.75
Drilling 2726 0.1942
Drilling 1026 0.05578
Travel 175 1

I modified the query to retun sum of the cost and time_spent.
SELECT Qry_detail_cost.group, sum(Qry_detail_cost.COST),
sum(Qry_detail_cost.time_spent)
FROM Qry_detail_cost
group by Qry_detail_cost.group;
I got the following results
group SumOfCOST SumOftime_spent
AddServices 65 0.5
Casing 136.25 0.25
Drilling 3989.5 0.75
SiteRequirements 408.75 0.75
Travel 568.75 3.25

You can see SiteRequirements only take one value. It is not sum of two
records. If I change one of time_spent a littile to make sure these are not
duplicated. I got the result as expected. I really need real sum even if
there are duplicates. Can someone help me to get result as I expected? Thank
you.
 
Top