sqliteselectactiveandroid

"NOT" clause in active android?


Anybody know how to do "NOT" clause in Active Android Select Query?

My code is :

ArrayList<MyModel> arrayList = new Select().from(MyModel.class).where("userId NOT","1").execute();

This one does not work.How do I implement not clause here?Here userId is my column name.I want to get the List of values except for the userId of 1.


Solution

  • Just use the SQL syntax

    ArrayList<MyModel> arrayList = new Select().from(MyModel.class).where("userId <> 1").execute();
    

    Or if you want to take the value 1 from a variable like x

    ArrayList<MyModel> arrayList = new Select().from(MyModel.class).where("userId <> ?", x).execute();