Cursor cursor = db.rawQuery("SELECT id,no,name,lastname FROM mytable WHERE " +
"id = (SELECT MIN(id) and no=0 FROM mytable ); ",null);
I am getting that error at below, Could you please help me ?
What I want is to retrieve the record that has min Id where no=0 in the mytable….
Error:android.database.sqlite.SQLiteException: near “WHERE”: syntax error: , while compiling:
Without knowing too many specifics about sqlite syntax, I’d guess your subquery isn’t formatted quite right.
Try
or
depending on what your interpretation was (but it sounds like the first one). The first will return rows with the minimum
idwith also anoof 0, but the second query will return the minimumidand then use it to select for a row with anoof 0.