How to delete multiple rows whose value is contained in a list of values, at once?
If I want to delete multiple rows whose value (e.g. 'key') is included in a list of values, in raw SQL I can do something like this:
But, that seems to not be working correctly when using it in Drizzle, or I'm doing something completely wrong. Using MySQL.
Here's my code:
I tried also joining the keys to delete as a single string using
keysToDelete.join(",")
but that also didn't work.
The entries are not being removed from the database.
However if I want to check against a single value within the IN (...)
clause, it works fine.1 Reply
EDIT: Nevermind, found the reason for the issue.
Turns out that I didn't have to wrap the list of keys that I want to check against in parenthesis.
So this:
should become this:
Lost way more time than I intended to on this 🙂