I have a query to show current last balance of each customer and it gets all the customers from the table, Customer_Orders.Its sql expression is:
SELECT [Customer_Orders Query].Customer_ID, [Customer_Orders Query].Customer_Name, *
FROM [Customer_Orders Query]
WHERE ((([Customer_Orders Query].Customer_Order_ID)=(SELECT TOP 1 Customer_Order_ID FROM customer_orders AS P1 WHERE P1.customer_id=Customer_Orders.customer_id ORDER BY Customer_Order_Date DESC, Customer_Order_ID DESC)))
ORDER BY [Customer_Orders Query].Customer_Name;
My question is, How can I get the last balance of each customer upto any specific date, which I put in query.
SELECT [Customer_Orders Query].Customer_ID, [Customer_Orders Query].Customer_Name, *
FROM [Customer_Orders Query]
WHERE ((([Customer_Orders Query].Customer_Order_ID)=(SELECT TOP 1 Customer_Order_ID FROM customer_orders AS P1 WHERE P1.customer_id=Customer_Orders.customer_id ORDER BY Customer_Order_Date DESC, Customer_Order_ID DESC)))
ORDER BY [Customer_Orders Query].Customer_Name;
My question is, How can I get the last balance of each customer upto any specific date, which I put in query.