IN (SELECT K_IVINVT FROM C_CHNG)take the same 12-15 seconds as the original query.
in (<<mk_ivinvt>>)
take only .04 seconds???? It seems they should both be the same but then, as we all know, software works in strange and mysterious ways. set enginebehavior 90 mseconds = seconds() * mrecno = 1 use c_chng do while not eof('c_chng') mk_ivinvt = '' mcnt = 1 select c_chng goto mrecno scan while mcnt <= 120 if empty(mk_ivinvt) mk_ivinvt = mk_ivinvt + '"' + k_ivinvt + '"' else mk_ivinvt = mk_ivinvt + ',"' + k_ivinvt + '"' endif mcnt = mcnt + 1 endscan mrecno = recno() * TEXT TO mSqlCommand noshow pretext 15 TEXTMERGE update ivinvt set allocated = allocated + c_chng.chng from ivinvt, c_chng where c_chng.k_ivinvt = ivinvt.k_ivinvt and ivinvt.k_ivinvt in (<<mk_ivinvt>>) ENDTEXT &mSqlCommand enddo * wait window nowait transform(seconds() - mseconds, '99.999')