Reputation: 1879
I've an cursor that fills up my ListView in Android.
My code of cursor:
Cursor cursor = sqliteDatabase.query("ProductosTratamientos", null,
"codigoproducto <> '70027, 70029, 70024'", null, null, null, null);
It is not working. It continues filling the list with these values: 70027, 70029, 70024.
What am I doing wrong?
Thanks.
Upvotes: 0
Views: 1621
Reputation: 3697
Try this code:
Cursor cursor = sqliteDatabase.query("ProductosTratamientos", null,
"codigoproducto <> ? AND codigoproducto <> ? AND codigoproducto <> ?',
new String[]{"70027", "70029", "70024"},
null, null, null);
Upvotes: 1
Reputation: 68177
Instead of using <>
, you need to use NOT IN
which offers look-up with in a set of values. So try changing your query to something like:
Cursor cursor = sqliteDatabase.query("ProductosTratamientos", null,
"codigoproducto NOT IN (70027, 70029, 70024)", null, null, null, null);
Upvotes: 4