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
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