M
Marcin Peciak
Hi,
I have a table called "tblOrders", with has following field (example):
Order_Num | Created_Date | Customer_ID |
-----------------------------------------------------
1-22132 | 02/05/2009 | 1-AX23 |
....
I've added additional column to calculate number of days between
"Created_Date" and today, so I have a query that does something like this:
Counter: DateDiff("d", Created_Date, Date())
What I need is a select those rows from the table where Counter is min/max -
so, if I have two (or more) same records for the customer, I want to pick up
the most recent one (where Counter is min) or the oldest one - where Counter
is max.
When I tried to build queries, I was getting error messages saying that I
cannot aggragete min/max function.
Any suggestions?
Many thanks,
Marcin
I have a table called "tblOrders", with has following field (example):
Order_Num | Created_Date | Customer_ID |
-----------------------------------------------------
1-22132 | 02/05/2009 | 1-AX23 |
....
I've added additional column to calculate number of days between
"Created_Date" and today, so I have a query that does something like this:
Counter: DateDiff("d", Created_Date, Date())
What I need is a select those rows from the table where Counter is min/max -
so, if I have two (or more) same records for the customer, I want to pick up
the most recent one (where Counter is min) or the oldest one - where Counter
is max.
When I tried to build queries, I was getting error messages saying that I
cannot aggragete min/max function.
Any suggestions?
Many thanks,
Marcin