3 Replies Latest reply on Jun 24, 2016 1:36 PM by Hildebrando Souza Jr

    How to change the query based on input parameters?

    Gagan Thapar

      I have a query

       

      select * from x, y

      where x.a = y.a;

       

      which takes long time to run on the live database and it returns huge amount of rows. I wanted to run this query to get all the values and then put select the particular rows but apparently it's taking too much time.

       

      So I am trying to change my query to put the filters as parameters, because it's the quicker way. But I don't know how to dynamically change the query based on the user input e.g.

       

      If x.b is the input, the query should work like this:

       

      select * from x, y

      where x.a = y.a

      and x.b = <Parameter1>

       

      and if x.c is the input query should work like this:

       

      select * from x, y

      where x.a = y.a

      and x.c = <Parameter2>

       

      Basically, it has to ignore the parameter the user is not entering. Is it possible in tableau? If not, what's the right way to do so? Thanks