Here is my query,
<Request method="GET">
<Query>
select user_id from user
where user_type in ($userTypes)
</Query>
</Request>
How do I sent multiple values for this parameter $userType in metamug resource file. I'm using a GET request. And my database is postgres.
$userTypes is list of ids. I can pass it as comma separated string "1501,1502,1503" in the request.
Thanks.
You could use:
select user_id from user
where user_type in (SELECT unnest(string_to_array($userTypes, ',')));
DbFiddle Demo
you can also write it as
<Request method="GET">
<Query>
select user_id from user
where user_type =any(string_to_array($userTypes,',')::int[]);
</Query>
</Request>
I've typecast it as Integer array you can use any other datatype as per your need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With