How to deal with raw queries in Android DB that contain a lot of arguments? For example SELECT * FROM table WHERE table.column IN (15, 14, 17, 19)
. Can I use precompiled SQL with ?
selections, or is there no other choice than to format each query individually with concatenation?
I'm doing
SQLiteDatabase.rawQuery("... WHERE table.column IN (?)", selectionArgs);
where selectionArgs
is String
of joined IDs, but the query won't execute.
No, you can't do that. You have to use ... WHERE table.column IN (?, ?, ?, ?)
and add the parameters separately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With