mercredi 2 mars 2016

SQLite multiple where in the same column

I have a table like this:

Char1       Char2       Difficulty
--------------------------------------------------
jon          sara          1
pablo        victor        2
laura        patricia      1
marta        juanjo        3
marina       goku          4

I want to select all the rows where difficulty = 1 and difficulty = 2. I have tried to do:

"SELECT * FROM " + table + " WHERE " + DatabaseOpenHelper.COLUMN_DIFFICULTY + "LIKE '1%'" + " AND " + DatabaseOpenHelper.COLUMN_DIFFICULTY + "LIKE '2%'" 

But it's not working, I am new to SQLite so I will appreciate any explanation with the answer. Thanks!

Aucun commentaire:

Enregistrer un commentaire