samedi 5 septembre 2015

SQlite Android Where clause from multiple table using NOT IN

I am unable to run a query in sqlite android, it is throwing below error:

android.database.sqlite.SQLiteException: no such table: table1.item1 (code 1): ,while compiling: SELECT * from table1, table2 where table1.item1 not in table2.item1

my raw query is:

Database.rawQuery("SELECT * from "+ TABLE1 +", "
    +TABLE2+" where "+ TABLE1 +"" + "."+ ITEM1 +" not in "
            + TABLE2 +"."+ ITEM1, null);

String constants:

TABLE1= "table1", TABLE2="table2", ITEM1= "item1"

I want all the rows in table1 whose item1 is not in the list of item1 values in table2.

Do I need to add some group by statement? Can someone please tell what am I missing here?

Aucun commentaire:

Enregistrer un commentaire