Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

SUM column for all entries AFTER date

$
0
0
I can't seem to get this working how I need. The closest I have is as follows:
Code:

SELECT tblEmployeeData.TechID, Sum(tblOccurrence.OccurrenceAmt) AS OccurenceAmt_SUM, tblOccurrence.OccurrenceDate, tblOccurrence.CoachingDate
FROM tblEmployeeData LEFT JOIN tblOccurrence ON tblEmployeeData.TechID = tblOccurrence.TechID
GROUP BY tblEmployeeData.TechID, tblOccurrence.OccurrenceDate, tblOccurrence.CoachingDate
HAVING ([tblOccurrence].[CoachingDate] >= DateAdd('m',-6,Date()))

The issue is that the SUM column isn't collecting all the rows needed for an accurate sum. The problem is that there might be entries after [tblOccurrence].[CoachingDate] and it seems my query isn't accounting for those. How do I make this query work the way it's supposed to? I'm destroying my brain trying to reach a solution.

Viewing all articles
Browse latest Browse all 13329

Trending Articles