Using tempoary state in SQL query not using =

I'm trying to use temp state to fill in the where clause of a postgresql query. The query works as expected if I do an = evaluation such as:

select * from account where id = {{account_id.value}};

with temp-state being
account_id.value = 12345

but if I try to do

select * from account where id in ({{id_list.value}});

with temp-state being
id_list.value = 12345, 9876
id_list.value = '12345','9876'

the query runs but never returns any results. If I try to include the () in the temp-state value rather than the SQL query, the query fails to syntax error. If the id_list.value has only 1 item in it the query returns results as expected, but that isn't very useful.

Try using = ANY({{id_list.value}}) instead of IN

1 Like