Query Question

  • Thread starter Thread starter tom
  • Start date Start date
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?
 
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];
 
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?
 
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?
 
Back
Top