Re: Sum not working correctly
Sums multiply across joins as if driven by a sorcerer's apprentice. The solution is to move aggregation into a subquery, in your case something like ...
select sums.sumoftt, sums.sumofhours, l.webassigned
from `dispatch report` d
left join dispatch_local l on ...
left join (
select dbsapro, dbsaproline, sum(targettime) as sumoftt, sum(dbhours) as sumofhours,
from tbtimecard
group by dbsapro, dbsaproline
) as sums on sums.dbsapro = d.repairorderno and sums.dbsaproline = d.repairorderlineitem
where .....
Subject
Written By
Posted
Re: Sum not working correctly
January 30, 2015 10:18AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.