How I can get only last date order for all customers with more fields from tblCustome

haris

Registered User.
Local time
Today, 10:17
Joined
Feb 12, 2002
Messages
13
Hello!

EXPLANATION: Table tblCustomers has field named Customer which is Primary Key. Table tblOrders has fields Customer (linked by Primary field in tblCustomers), OrderDate, OrderAmount, OrderDescription etc. I wish make a list for all Customers but only last Order for each of them specified in OrderDate field. I tried with next Query:

SELECT tblOrders.Customer, Max(tblOrders.OrderDate) AS MaxOrderDate
FROM tblOrders
GROUP BY tblOrders.Customer
and everything is OK, but .....

PROBLEM IS: When I add more than one field from tblOrders in Query syntax! I always get more customers with all orders. Sample:

SELECT tblOrders.Customer, Max(tblOrders.OrderDate) AS MaxOrderDate, tblOrders.OrderAmount, tblOrders.OrderDescription
FROM tblOrders
GROUP BY tblOrders.Customer, tblOrders.OrderAmount, tblOrders.OrderDescription

I have problem here! I always get all orders for all customers. I NEED ONLY LAST WITH MORE FIELDS FROM tblOrders!

Good Luck and thank you for answer!

Haris
 
The reason why you're not getting the desired result is in the combination of columns you're retrieves through your query

Search the Queries forum for "most recent", you surely will find a solution.

RV
 
Thanks RV!

I solved my problem. I try to do this few weeks. Thank you, one more time!

Greetings from Sarajevo,
Haris
 

Users who are viewing this thread

Back
Top Bottom