I'm trying to create a list of all the oldest orders my customer has. but I can't seem to get my subquery to list one record for each CustomerID. Whenever I add the Order Amount to the subquery every orders lists.
I have these tables
tblCustomers - Customer ID, Customer Name, etc.
tblCustomerOrders - OrderID, OrderDate, OrderAmount
I want a list that has Customer ID, DateOfOldestOrder, Amount
first query [qryCustomerOrdersOldest]
SELECT tblCustomerOrders.CustomerID, Min(tblCustomerOrders.OrderDate) AS MinOfOrderDate
FROM tblCustomerOrders
GROUP BY tblCustomerOrders.CustomerID;
subquery
SELECT tblCustomerOrders.OrderAmount, qryCustomerOrdersOldest.CustomerID, Min(qryCustomerOrdersOldest.MinOfOrderDate) AS MinOfMinOfOrderDate
FROM qryCustomerOrdersOldest LEFT JOIN tblCustomerOrders ON qryCustomerOrdersOldest.CustomerID = tblCustomerOrders.CustomerID
GROUP BY tblCustomerOrders.OrderAmount, qryCustomerOrdersOldest.CustomerID;
I have these tables
tblCustomers - Customer ID, Customer Name, etc.
tblCustomerOrders - OrderID, OrderDate, OrderAmount
I want a list that has Customer ID, DateOfOldestOrder, Amount
first query [qryCustomerOrdersOldest]
SELECT tblCustomerOrders.CustomerID, Min(tblCustomerOrders.OrderDate) AS MinOfOrderDate
FROM tblCustomerOrders
GROUP BY tblCustomerOrders.CustomerID;
subquery
SELECT tblCustomerOrders.OrderAmount, qryCustomerOrdersOldest.CustomerID, Min(qryCustomerOrdersOldest.MinOfOrderDate) AS MinOfMinOfOrderDate
FROM qryCustomerOrdersOldest LEFT JOIN tblCustomerOrders ON qryCustomerOrdersOldest.CustomerID = tblCustomerOrders.CustomerID
GROUP BY tblCustomerOrders.OrderAmount, qryCustomerOrdersOldest.CustomerID;