You can translate the question and the replies:

Parameterised query Problem with IN clause when passing Array of String

Hello, I am stuck at one point while working on Denodo REST Web Service. Actually, i am creating view through SQL query. In my SQL query there is IN condition in where clause and the array of string values are used in IN condition. The values i am passing through GET request when i am calling REST API. Consider that the below given is my SQL query. Select * from order where mobile IN (Select mobile from user where uname IN (‘test1’, ‘test2’, ‘test3’)). Now here i am given the values (‘test1’, ‘test2’ ,’test3’) at the time of view creation. it works fine. But I want that to be parameterised so i will pass value through querystring in GET request. So i have made my SQL query as: Select * from order where mobile IN (Select mobile from user where uname IN (@username)). And now i am passing whole array of string named username in querystring by sending get request to REST API. I have debugged things and i came to know that username is directly replaced with array of string and that is why it is considering whole string array as a one value and it is giving no records. So please help me with this issue
user
14-05-2020 07:23:38 -0400

1 Answer

Hi, The section [Input Parameters of Restful web services](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/restful_architecture/restful_web_service/input_parameters_of_the_restful_web_service#input-parameters-of-the-restful-web-service) explains how to configure any condition using the $filter parameter in the url. For your case, a sample where condition will look like this: `$filter=username%20in%20%27%27%27test1%27%27,%27%27test2%27%27%27` which is equivalent to $filter=username+in+'''test1'',''test2''' Hope this helps!
Denodo Team
15-05-2020 09:30:58 -0400
You must sign in to add an answer. If you do not have an account, you can register here