English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How do I select only the last entered order for each cusstomer from my customer orders table? One customer has ordered today & other customers placed orders earlier.

2006-09-01 08:38:00 · 5 answers · asked by Kenneth E 1 in Computers & Internet Programming & Design

5 answers

I assume you have two tables, one holding the customer details, one holding the customer orders with a linked field between the two. The customer orders table should also have a date field as to when the order was placed.

In Access, Design a new query to show only the latest orders. To do this show the customer orders table and the relevant fields you would like to see including the order date field and the customer ID field. Press the Totals button in the toolbar (Σ) and change the order date field from 'Group By' to 'Max'. Save this query.

Design a new query and add the Customer table and the new query with the ID fields linked. Add the relevant customer fields to your query as well as the order fields you would like to see. The results of this query are customers and their last orders.

2006-09-04 08:37:58 · answer #1 · answered by Dale A 1 · 0 0

There should be:
(1) DATE field on your table which will input the date when it was ordered; or
(2) SEQ field that will sequentially numbered the order.

And then on your Query1, based on date:

SELECT *
FROM [customer order]
WHERE
YourDateField=
format(now,'mm/dd/yyyy')

OR, if you rely on sequence, then this is on your Query1:

SELECT SEQ, IDNO
FROM [customer order]
WHERE
SEQ IN (SELECT MAX(SEQ) FROM [customer order])

OR, as you said query each customer's last order, then your Query1 should be like:

SELECT FIRST(NAMES), MAX(DateOrderField)
FROM [customer order]
GROUP BY NAMES;

2006-09-01 13:57:24 · answer #2 · answered by VBACCESSpert 5 · 0 0

workplace isn't a loose software. although there are Pirate cyber web web pages the place you may get an unlawful reproduction. or you should use Open workplace it is in simple terms about the comparable and loose. or you should use Microsoft SkyDrive the place you will wonderful word, Excel, Powerpoint and Onenote for loose USE. you in simple terms want a loose Microsoft stay account. in simple terms Google "skydrive".

2016-11-23 17:56:55 · answer #3 · answered by Anonymous · 0 0

SELECT fieldsyouwant, MAX(date) FROM customer_order GROUP BY customer_id

this should work, not sure though.

2006-09-01 09:17:16 · answer #4 · answered by Bruno 3 · 0 0

click on start/allprograms
customers /tools

2006-09-01 08:40:53 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers