HI,in SP I have this query
  FOR EXECUTE STATEMENT 'SELECT SUM(CANT)  FROM TABLE1 WHERE FIEL1='||:F1||' 
AND FIEL2='||:F2|| IIF(:pCondition=1,' AND FIEL3='||:F3,'')  INTO .. DO ..
  TABLE1 PK =FIELD1,FIELD2,FIELD3

 running the query gives a NATURAL PLAN
How to make it use the index?
Index is used if I change to:    FOR SELECT SUM(CANT)  FROM TABLE1 WHERE 
FIEL1=:F1 AND FIEL2=:F2 AND FIEL3=:F3 INTO .. DO ..
but this way I can't use the IIF condition that I need
thanks!
 
  • [firebird-s... 'Mr. John' mr_joh...@yahoo.com [firebird-support]
    • Re: [f... setysvar setys...@gmail.com [firebird-support]
      • Re... 'Mr. John' mr_joh...@yahoo.com [firebird-support]
        • ... Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
          • ... 'Mr. John' mr_joh...@yahoo.com [firebird-support]
            • ... Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
              • ... 'Mr. John' mr_joh...@yahoo.com [firebird-support]
            • ... liviusliv...@poczta.onet.pl [firebird-support]
              • ... 'Mr. John' mr_joh...@yahoo.com [firebird-support]

Reply via email to