>SELECT * FROM it!lotmast INTO CURSOR CURS1 > >tcFlCode = 'PMR12043' > >SELECT ex_flcode, ex_price * ex_qty * IIF(ex_factor > 0,ex_factor,1) AS sqAmount, ex_exptype ; > FROM it!expnsinv ; > WHERE ex_flcode$tcFlCode ; > AND ex_dlvdat >= (SELECT MIN(lm_dlvdat) FROM CURS1) ; > AND ex_dlvdat <= (SELECT MAX(lm_dlvdat) FROM CURS1) ; > INTO CURSOR cursExpenses >curs1 should be created with nofilter at least. However this is not an effective SQL.
local array aMinMax[2] aMinMax = 0 && or something that'd match datatype SELECT MIN(lm_dlvdat),MAX(lm_dlvdat) FROM it!lotmast INTO array aMinMax tcFlCode = 'PMR12043' SELECT ex_flcode, ex_price * ex_qty * IIF(ex_factor > 0,ex_factor,1) AS sqAmount, ex_exptype ; FROM it!expnsinv ; WHERE ex_flcode$tcFlCode ; AND ex_dlvdat between aMinMax[1] and aMinMax[2] ; INTO CURSOR cursExpensesCetin