Query To Show Balance Of Each Customer

zibzaba

Registered User.
Local time
Today, 15:14
Joined
Jan 7, 2010
Messages
41
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.
 
On the assumption (always dangerous) that your Customer_Orders_Query is a table containing all the orders and that each order has a date, you could try putting a (Date) Criteria in this Query such that when it runs, it only totals up to the date you require.

Something like this may do

<= [Enter Date here as dd/mm/yy]
 
ok, but how I put this in sql......... I dont know............
 

Users who are viewing this thread

Back
Top Bottom