
Signature
KARL DEWEY
Build a little - Test a little
Karl,
I will try that. Thanks!
> Try this ----
> SELECT [YourTable].Employee, Sum([YourTable].absences) AS SumOfabsences
[quoted text clipped - 34 lines]
> > > >
> > > > huber57
Karl,
Here is my SQL. Now it no results. I have checked the data to ensure that
there should be results.
SELECT Employee_Table.FirstName, Employee_Table.LastName,
Sum(Occurrence_Table.OccurrenceType) AS SumOfOccurrenceType,
Occurrence_Table.StartDate
FROM Occurrence_Type_Table INNER JOIN (Employee_Table INNER JOIN
Occurrence_Table ON Employee_Table.EmployeeID = Occurrence_Table.EmployeeID)
ON Occurrence_Type_Table.OccurenceType = Occurrence_Table.OccurrenceType
GROUP BY Employee_Table.FirstName, Employee_Table.LastName,
Employee_Table.FormerEmployee, Occurrence_Table.StartDate
HAVING (((Sum(Occurrence_Table.OccurrenceType))>=3.95) AND ("AND"=Date()-365))
ORDER BY Sum(Occurrence_Table.OccurrenceType) DESC;
Any thoughts?
Thanks much.
> Try this ----
> SELECT [YourTable].Employee, Sum([YourTable].absences) AS SumOfabsences
[quoted text clipped - 34 lines]
> > > >
> > > > huber57
John Spencer - 15 Nov 2007 12:46 GMT
First you can't show the StartDate. If you do you will get one line for
each date.
You can show the first and last startdate by using min and max on separate
occurences.
SELECT Employee_Table.FirstName, Employee_Table.LastName,
Sum(Occurrence_Table.OccurrenceType) AS SumOfOccurrenceType
FROM Occurrence_Type_Table INNER JOIN (Employee_Table INNER JOIN
Occurrence_Table ON Employee_Table.EmployeeID = Occurrence_Table.EmployeeID)
ON Occurrence_Type_Table.OccurenceType = Occurrence_Table.OccurrenceType
WHERE Occurrence_Table.StartDate >=Date()-365
GROUP BY Employee_Table.FirstName, Employee_Table.LastName,
Employee_Table.FormerEmployee
HAVING Sum(Occurrence_Table.OccurrenceType)>=3.95
ORDER BY Sum(Occurrence_Table.OccurrenceType) DESC;
Aggregate queries (totals queries) can be filtered in two way.
-- Using a where removes records before the totaling is done
-- Using Having removes records after the totaling is done
In design view to use where, select WHERE in the totals line and put the
criteria in. Notice that you can't use WHERE and show the field.
If you use any other option in the totals line then the records are filtered
(HAVING) after the records are totaled.

Signature
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
> Karl,
>
[quoted text clipped - 61 lines]
>> > > >
>> > > > huber57
Huber57 - 15 Nov 2007 13:15 GMT
John,
YOU ARE THE MAN! Thanks much for the solution and the explanation.
It worked perfectly. I even got sexy and made it greater than 3.95 and less
than 6.
I appreciate the help.
> First you can't show the StartDate. If you do you will get one line for
> each date.
[quoted text clipped - 89 lines]
> >> > > >
> >> > > > huber57