Subject Date compare in firebird
Author redtneen
hi
i made this statement

execute block
returns (
"Account" integer,
"Debit" numeric(18,4),
"Credit" numeric(18,4),
"PriorBalance" numeric(18,4),
"Balance" numeric(18,4)
)
as
declare variable "aAcc" integer;
declare variable "ItmSite" integer;
declare variable "ItmDate" date;
declare variable "aDebit" numeric(18,4);
declare variable "aCredit" numeric(18,4);

begin

for
select "ItmSite", "ItmDate", "ItmAccount", "ItmLocalDebit",
"ItmLocalCredit"
from "VouItems"
where ("ItmAccount"=11)

into :"ItmSite", :"ItmDate", :"aAcc", :"aDebit", :"aCredit"
do
begin
if ( ("ItmDate" between '05/01/2006' and '06/30/2006') or
("ItmDate" between '08/01/2006' and '08/31/2006')) then
begin
--some calculations
end
if ( ("ItmDate"<='04/30/2006')) then
begin
--some calculations
end
end

end

i take about 8 seconds to execute about 800000 records

when i removed just if statement the time decrease to about 4 seconds

is there any way to speed up this code ????

notice: this code is made in run time so i don't know how many dates
i would comapre

my regards to u