Query Question

T

tom

Let us say we have a table called GL with the following fields

DATE DEBIT CREDIT

Let us define balance as sum of CREDIT-DEBIT from a given start date. I
want the balance for every day from given start date to end date. How can
this be done?
 
K

KARL DEWEY

Try this ---
SELECT (Sum(YourTable.CREDIT) - Sum(YourTable.DEBIT)) AS Balance, [Enter
start date] AS Expr1, [Enter end date] AS Expr2
FROM YourTable
WHERE (((YourTable.Name) Between [Enter start date] And [Enter end date]))
GROUP BY [Enter start date], [Enter end date];
 
T

tom

Will this give every day or just the end date?

I want something that will output

Day 1 Balance
Day 2 Balance
Day 3 Balance
etc ... ... ...
day 30 Balance

KARL DEWEY said:
Try this ---
SELECT (Sum(YourTable.CREDIT) - Sum(YourTable.DEBIT)) AS Balance, [Enter
start date] AS Expr1, [Enter end date] AS Expr2
FROM YourTable
WHERE (((YourTable.Name) Between [Enter start date] And [Enter end date]))
GROUP BY [Enter start date], [Enter end date];

--
KARL DEWEY
Build a little - Test a little


tom said:
Let us say we have a table called GL with the following fields

DATE DEBIT CREDIT

Let us define balance as sum of CREDIT-DEBIT from a given start date. I
want the balance for every day from given start date to end date. How
can
this be done?
 
K

KARL DEWEY

I noticed an error --
WHERE (((YourTable.DateField) Between [Enter start date] And [Enter end
date]))

--
KARL DEWEY
Build a little - Test a little


KARL DEWEY said:
Try this ---
SELECT (Sum(YourTable.CREDIT) - Sum(YourTable.DEBIT)) AS Balance, [Enter
start date] AS Expr1, [Enter end date] AS Expr2
FROM YourTable
WHERE (((YourTable.Name) Between [Enter start date] And [Enter end date]))
GROUP BY [Enter start date], [Enter end date];

--
KARL DEWEY
Build a little - Test a little


tom said:
Let us say we have a table called GL with the following fields

DATE DEBIT CREDIT

Let us define balance as sum of CREDIT-DEBIT from a given start date. I
want the balance for every day from given start date to end date. How can
this be done?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top