Re: left join with sum and group by
Posted by:
Rick James
Date: August 27, 2010 08:01PM
Or, maybe I did not do the JOIN right...
SELECT a.date, a.weekday, a.workinghours,
e.employee,
sum(b.hours),
sum(b.hours) - a.workinghours
FROM a
JOIN ( SELECT DISTINCT employee FROM b ) AS e
LEFT JOIN b ON a.date = b.date
AND e.employee = b.employee -- added this
GROUP BY a.date, e.employee
Subject
Views
Written By
Posted
24344
August 18, 2010 05:46AM
8498
August 20, 2010 11:40PM
4643
August 23, 2010 04:26AM
Re: left join with sum and group by
6715
August 27, 2010 08:01PM
4148
September 07, 2010 05:08AM
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.