10 Replies Latest reply: May 18, 2018 1:31 PM by Eduardo DImperio RSS

    Using variable in SQL where clause

    Daniel Rodríguez

      Hi all

       

      I'm facing an issue I can't solve although there is some information on internet....

       

      I want to create a variable with contains just a date like this:

       

      LET vMaxDate = peek('MaxDate');

       

       

      Then, I want to use it in a SQL where clause, like this:

       

       

      and datediff(mm,start_date,$(vMaxDate)) between 0 and 11

       

      But it's not working...I've also tried doing the following:

       

      and datediff(mm,start_date,'$(vMaxDate)') between 0 and 11

       

      But still not working....I'm sure there is something I'm missing but I am not able to see it.

       

      Does anyone know how to fix it? Thanks in advance

       

      Daniel