mySQL query with IN

Hi,

I’m trying to run a simple query, with a condition that checks if the Status Code is IN a list of values.

StatusCode is a VARCHAR(20)

The query looks like this:

There are records that meet the condition. If I run the exact same query from Heidi (the SQL database management tool that I use), the database returns them.

Wappler, however, returns nothing. This is my result:

{
“query1”:
}

conversely, if I put a NOT IN with the same list, I get all the records, even those that do not match the strings in the list.

What am I doing wrong?
Many thanks for your help,

Alex

Hello,
The IN condition expects an array and not a comma separated list. You need to add:

{{"0,1,2,3".split(",")}}
1 Like

Oh…
I saw something like that in another post, but thought it was for numeric values. Trying now…

Works like a charm!
Thank you.

I would have never guessed that this is the “right” way to do it, especially because I see a query built below that looks syntactically correct. Would it make sense to fix the parser so one does not have to put that expression? Now, I guess that it may break many other things… I’ll leave it up to you guys. Alternatively, put a hint to the developer somewhere.

Well usually you are using some dynamic expression there, which returns an array - not just static value, but for static values that’s the way of using it.

Understand. Thx Teodor.