Board index » delphi » total amounts between two dates

total amounts between two dates

If any kind person could help a newbie to calculate an amount between two
dates I would be very gratefull..I'm using dbase, a one to many setup..
one client many payments.Every works fine(thanks to the data wizard setup)
but to finish off with the above feature would be great!!
Tia,
Brendan
 

Re:total amounts between two dates


You can use a TQuery object and select it in using SQL.  The following example
is using the DBDEMOS database that comes with Delphi C/S:

select sum(itemsTotal) from orders
where
SaleDate >= '4/12/88' and
SaleDate<='5/25/88'

Now if you have to do a join you would do something like this:

select sum(a.itemsTotal) as total, b.company from orders a,
customer b
where
a.SaleDate >= '4/12/88' and
a.SaleDate<='5/25/88'
and a.custno = b.custno
group by b.company
Hope this helps

Other Threads