vendredi 26 décembre 2014

java - SQLite - How to use the set of values for one coumn in where clause?

I want create query like that:



SELECT * FROM my_table WHERE column_1 in (1, 2, 3)


This query works at SQLite editor. But I want to use it in java. I try to use it like that:



String query = "SELECT * FROM mu_table WHERE coumn_1 in ?";
String[] args = {"(1, 2, 3)"};
Cursor c = db.rawQuery(query, args);


But this doesn't work. The following error occurs:



near "?": syntax error (code 1): , while compiling: SELECT * FROM my_table WHERE column_1 in ?


What is incorrect? What is correct way?


Aucun commentaire:

Enregistrer un commentaire