akira220984
Programmer
Hi,
I'm new to this forum and to sql server / tsql in general, so go easy on me
Below I have some code which I have been asked to optimise as it runs far too slow. If there any pointers as to how I could go about this, it would be greatly appreciated.
If you need any other information, please ask and I will reply asap.
update ledgerTestRS
set RunningBalance =
(select sum(total)
from ledgerTestRS as innerLoop
where innerLoop.company_name = outerLoop.company_name
and innerLoop.ledger_name = outerLoop.ledger_name
and innerLoop.longtransactiondate <= outerLoop.longtransactiondate)
from ledgerTestRS outerLoop
inner join #tmpchanges on (outerLoop.ledger_id = #tmpchanges.ledger_id)
Ric
I'm new to this forum and to sql server / tsql in general, so go easy on me

Below I have some code which I have been asked to optimise as it runs far too slow. If there any pointers as to how I could go about this, it would be greatly appreciated.
If you need any other information, please ask and I will reply asap.
update ledgerTestRS
set RunningBalance =
(select sum(total)
from ledgerTestRS as innerLoop
where innerLoop.company_name = outerLoop.company_name
and innerLoop.ledger_name = outerLoop.ledger_name
and innerLoop.longtransactiondate <= outerLoop.longtransactiondate)
from ledgerTestRS outerLoop
inner join #tmpchanges on (outerLoop.ledger_id = #tmpchanges.ledger_id)
Ric