Hi all,
What I need is to get the total rate for each account and write it to a new table with that distinct account# (strap) & its total rate.
table: parcel_tax
strap tax_dist
12345 001
12345 002
12345 003
12345 004
01111 001
01111 007
01111 003
table: tax_dist
cd curr
001 1.1
002 0.5
003 2.0
004 0.1
Below is what I have so far. The problem is I suspect this way takes a very long time since I have more than 10 records in table parcel_tax. There must be a better way to do this just that I do not know. Any help is greatly appreciated.
fetch next from cRoll into @acct
while (@@fetch_status <> -1) begin
set @tax_rt = 0.0
select
tax_rt = sum(curr)
from tax_dist
where cd in
(select tax_dist from parcel_tax where strap = @acct)
fetch next from cRoll into @acct
end
close cRoll
deallocate cRoll
set nocount off
What I need is to get the total rate for each account and write it to a new table with that distinct account# (strap) & its total rate.
table: parcel_tax
strap tax_dist
12345 001
12345 002
12345 003
12345 004
01111 001
01111 007
01111 003
table: tax_dist
cd curr
001 1.1
002 0.5
003 2.0
004 0.1
Below is what I have so far. The problem is I suspect this way takes a very long time since I have more than 10 records in table parcel_tax. There must be a better way to do this just that I do not know. Any help is greatly appreciated.
fetch next from cRoll into @acct
while (@@fetch_status <> -1) begin
set @tax_rt = 0.0
select
tax_rt = sum(curr)
from tax_dist
where cd in
(select tax_dist from parcel_tax where strap = @acct)
fetch next from cRoll into @acct
end
close cRoll
deallocate cRoll
set nocount off