Dear all,
I found that using SELECT SUM() is outperform FOR EACH / OPEN QUERY. Does anyone can tell me why ?
1. SQL statement : SELECT SUM( credit ) from customer where cust-no > 20000.
( there are about 33000 customers with cust-num > 20000 and it tooks 19s)
2. For each customer where cust-no > 20000 no-lock :
accumulate customer.credit ( total ).
end.
disp ( accum total customer.credit ).
This took 60s. If using open query, it is worst, took 140s.