Passing an list of values to an IN clause in MySQL

Hi! I have what seems like a very simple problem, but can't solve it.

I need to pass the values from a select component (or another component) to an IN query in MySQL.

An example query would be:

select *
from orders
where type in ('string1', 'string2))

However, when I pass two strings from a Select component, the query returns an error or null, because the strings are not properly encased in single quotes. I've tried transforming the select1.values output into a comma separated list, and also adding the single brackets into the value field of the component.

Any ideas?

Screenshot 2023-06-06 at 6.51.41 PM

Hey! You definitely should be able to do this. I'm attaching two examples. One from a select component and one from a multiselect component.

  1. Select:

  2. Multiselect:

From your screenshot it looks like you want to search for orders that have either a 'partial' or 'limited' service_type. Is it possible to have those values as separate options in a multiselect component?

If not, and you can only retrieve them as "partial, limited", I would suggest using a JS query to parse the value into a array that you can use in the SQL query.

Let us know if you have any other follow up questions!