Query Date

  • Thread starter Thread starter Joseph
  • Start date Start date
J

Joseph

I have a query that returns the emplyee id, number of
days worked and total dollars spent on that employee. My
problem is that I would like to to have a start date and
end date, but whenever I try i no longer get the totals
by employee id but for each day worked. Any help is
greatly appreciated.
Thanks
Joseph
 
Post the SQL of the query that works and the one that you've tried. Also
include information about the setup of your table.

Not clear from your post what your setup is, and we need more info.
 
A WILD GUESS as you have given us no details to work with. The SQL statement
would possibly look like:

SELECT EmployeeID,
Count(DateField) as CountOfDays,
Sum(Dollars) as SumOfDollars,
Min(DateField) as StartDate,
Max(DateField) as EndDate
FROM SomeTable
GROUP BY EmployeeID
 
Thanks for the help. This has pointed me in the right
direction. One additional question is, how can I then
query the database to return only records between a
certain StartDate and EndDate?

Thank you.
Joseph
 
Add a WHERE clause between the FROM and Group By clauses.

WHERE DateField Between #1/1/04# and #3/30/04#
 
Thanks again for the help. It works.
-----Original Message-----
Add a WHERE clause between the FROM and Group By clauses.

WHERE DateField Between #1/1/04# and #3/30/04#

.
 
Back
Top