vendredi 18 septembre 2015

Run OR statement in SQLiteOpenHelper for the same column

I have a function in my DatabaseHelper class (extends SQLiteOpenHelper) that returns row based on a certain column's value. Code snippet as follows:

Cursor cursor = db.query(TABLE_LOCATIONS, new String[]{}, COLUMN_PROD_ID+"=?", productId, null, null, null);

Where productId is a String[] that contains only 1 value.

Now I want to reuse the same function for matching 2 values for the same column. Something like:

SELECT * FROM TABLE WHERE COLUMN1 = VALUE1 OR COLUMN1 = VALUE2;

How can I achieve this in SQLiteOpenHelper. Kindly bear with me if this is a stupid question. Thanks.

Aucun commentaire:

Enregistrer un commentaire