How to use `in` condition in `where` clause
I want to do this, but with a dynamic list of masterid's :
SELECT * FROM tstrings WHERE masterid IN (1, 2, 3)
Could that be added to the documentation?
Thanks!
Ah right.
That'd simply be
const xs = [1, 2, 3]
sql`
SELECT * FROM tstrings WHERE masterid IN (${ xs })
`
Good idea about having this example in the docs, I'll think of where to add it, but PR is also very much welcomed ;)
Do note that the postgres protocol limits you to max 65534 parameters, so if your total number of dynamic parameters in the query exceeds that you'll get an error telling you that. (in this specific query it'll happen if your array's length is above 65534)
Nah, I'll keep this open until an example is in the docs ;)