General information
Category:
Coding, syntax & commands
Title:
Slow select statement
The following select statement works fast from the command window, however it is noticably slower in my form. It is optimizing all the indexes.
SELECT Scorder.ord_acct, Scorder.ord_order, scordln.orl_qty-scordln.orl_qtypicked-scordln.orl_qtyrec as qtyonorder;
FROM scorder LEFT OUTER JOIN scordln ;
ON Scorder.ord_order = Scordln.orl_order ;
where scorder.ord_acct < 200 and upper(scordln.orl_sku) = upper(tcSku) and scordln.orl_dunn # "X";
into cursor cTemp
I changed my form to use the following scan and insert. It is a lot faster.
select scordln
scan for upper(scordln.orl_sku) == upper(tcSku) and scordln.orl_dunn # 'X'
=seek(scordln.orl_order,'scorder','ord_order')
if scorder.ord_acct < 200
insert into cstockorder(cst_acct , cst_order , cst_qty) ;
values (scorder.ord_acct, scorder.ord_order, scordln.orl_qty-scordln.orl_qtypicked-scordln.orl_qtyrec)
endif
endscan
Is a scan & insert normally faster than a select into a cursor?
Thanks
Pat
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only