Questions About Query Using IN clause

I'm trying to perform a very simple query, but I can't seem to get it to work using the IN clause.

All I'm trying to do is return items from a table where the ID is IN a list of IDs

Something like:

WHERE "id" IN (1,3,5);

It works fine using a Custom query, where I can just type the literal values.

But I'm trying to do it in a standard Query using the Query Builder UI.

I can't work out what to put in the value field - everything I've tried so far results in the following error:

syntax error at or near "$1"

What do I need to put in the value field to make it work?

So far I've tried:

[1,3,5]
{{[1,3,5]}}
{{"1,3,5".split(",")}}

As well as using variables (number arrays, string arrays split by ','), and parameters, and everything I've tried results the same error.

Is this a bug, or am I doing something wrong?

(ultimately, I want to be able to use a variable/pramater for the list of IDs - but right now I can't even get it to work with a static list).

Thanks

welcome @Dan146

the IN clause waiting for a pure array. Not Array of objects

So, provide a valid array and then test your query (api) on your browser.
(Custom queries and queries cintaining IN clauses I can't preview them inside the query builder)

1 Like

@famousmag thanks very much.. you're absolutely right...

It does actually work in the browser - (I hadn't checked)... just not in the query preview - thanks for pointing that out.

It's all good now :slight_smile:

1 Like