I want to use the SQL SELECT DISTINCT book FROM bible ORDER BY book; using the SQliteDatabase query method, I try :-
Cursor csr = mDB.query(true,TABLE_BIBLE,new String[]{COL_BIBLE_BOOK},whereclause,whereargs,null,null,COL_BIBLE_BOOK,"-999");
Two of the 4 query have boolean true for DISTINCT, both have to have LIMIT parameter. SQLite says negative for no limit but doing this gives error like
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bible/com.example.bible.MainActivity}: java.lang.IllegalArgumentException: invalid LIMIT clauses:-999
I know you can do with rawQuery but it not recommended to use it from Android Devloper Guide. So want to use query.
I know also you can do using large number that not good though it can confuse.
LIMIT -999? Why are you not using a positive number? By the way, using a native query is not so bad in this case, because there isn't much risk in being tightly coupled to SQLite running on the phone.LIMITclause in the first place? This is probably the reason why the API is rejecting it; it doesn't see the point. What is your intend SQL query?