last order date of 2004 (1 Viewer)

MarySan1

Registered User.
Local time
Today, 14:44
Joined
Mar 20, 2002
Messages
19
I am trying to run a query that will give me all of my customers who last purchased on or before 2004. I do not want anyone who purchased anything in 2005. I am including, name, address, telphone number, salesman, order date, and shipping method. I leave all criteria blank, and I have the order date totaled at "max", I run the query, then I filter the form for the shipping method of "no cod". When I run the query, it gives me my customer listing for everyone who purchased from 1999 on and where shipped out no cod. That is fine, except that some of the customers are listed a few times with different dates. Say, John Smith, my query is coming up with an order from 1-5-99 and then a few pages later, (because I am also putting it in descending order) he is on another page with the date of 2-5-2000. Why is this? In my criterea for the "order date" I have it as "MAX", which should bring me this customer only once. Is that correct? I am really having trouble with this. Can anyone help? I only want the customers listed once with their last order date.
 

Brian1960

Brian1960
Local time
Today, 14:44
Joined
Aug 13, 2004
Messages
141
Grouping

You need to add grouping to your first query but port it so we can look at it, more closely.
 

MarySan1

Registered User.
Local time
Today, 14:44
Joined
Mar 20, 2002
Messages
19
what do you mean by grouping? I already have the order date grouped at "max". Do you mean group the customer also? If so, what do I group it at? Last?
 

MarySan1

Registered User.
Local time
Today, 14:44
Joined
Mar 20, 2002
Messages
19
also, if I group the date by "last" it is still incorrect. It said one customers last date was in july, when I check their history, the real last date was in october. What could be the problem?
 

mresann

Registered User.
Local time
Today, 06:44
Joined
Jan 11, 2005
Messages
357
Create a subquery that contains just the customer ID in the SELECT line, with the WHERE clause the transaction date, limiting the field to only transaction dates from 1-1-2005 and later (probably from the Orders or the Transactions table). Once the subquery is finished, copy the SQL. Open your original query. In the Conditions box of the Customer ID field, type "Not In()". Paste the subquery between the paranthesis.

See if this helps.
 

Users who are viewing this thread

Top Bottom