How to get Max Date and use in a query

db2

Registered User.
Local time
Today, 07:31
Joined
Jun 4, 2007
Messages
23
I'm trying to figure out how to query to get the max donation date of a customer.

I want to say:

max(Donations.DonationDate) < 04/01/2007

When I try to perform the above in the criteria field it says "Aggregate Functions Cannot be used in a WHERE clause".

I need to find people who have not placed in order past a certain date, and it's seeming impossible!

Any help is appreciated.
 
Last edited:
Code:
select max(DonationDate), CustomerID
from Donations
group by CustomerID
having max(DonationDate) < #04/01/2007#
;

might work. I didn't try it out (my Access instance just blew up) but it seems to be about right, from my recollection of the syntax.
 

Users who are viewing this thread

Back
Top Bottom