lundi 25 avril 2016

SQLite where clause Issue

I have around 30 records into SQLite table, where 10 records belongs to source from Online and rest 20 records belongs to source from Offline.

Now, I want to get all the records that belongs to source from Online, for that I wrote this:

String sQuery = "SELECT * FROM " + TABLE_REMINDERS + " where " + KEY_SOURCE + " = 'Online'";

But by using above query, I am getting all the records available in database, no matter from where it belongs to Offline or Online

So where I have mistaken, why I am not able to get data that belongs to source 'Online' only

Whereas, I have used below query to delete data from table that belongs to source 'Online' and it works for me:

db.execSQL("delete from "+ TABLE_REMINDERS + " where " + KEY_SOURCE + " = 'Online'");

Aucun commentaire:

Enregistrer un commentaire