android - SQL Query issue -


struggling sql query work since morning. trying check if particular field has 0 value first 500 (record 1 records 500) records.

i tried following:

select * unmapptext  updatetime = '0' desc limit 0, 500; 

this gives me below error:

process: com.ylg.dbaccess, pid: 18738     android.database.sqlite.sqliteexception: near "desc": syntax error (code 1): , while compiling: select * unmapptext updatetime = '0' desc limit 0, 500             @ android.database.sqlite.sqliteconnection.nativepreparestatement(native method)             @ android.database.sqlite.sqliteconnection.acquirepreparedstatement(sqliteconnection.java:889)             @ android.database.sqlite.sqliteconnection.prepare(sqliteconnection.java:500)             @ android.database.sqlite.sqlitesession.prepare(sqlitesession.java:588)             @ android.database.sqlite.sqliteprogram.<init>(sqliteprogram.java:58)             @ android.database.sqlite.sqlitequery.<init>(sqlitequery.java:37)             @ android.database.sqlite.sqlitedirectcursordriver.query(sqlitedirectcursordriver.java:44)             @ android.database.sqlite.sqlitedatabase.rawquerywithfactory(sqlitedatabase.java:1316)             @ android.database.sqlite.sqlitedatabase.rawquery(sqlitedatabase.java:1255)             @ com.ylg.dbaccess.unmapptext (dbvalue.java:3312)             @ android.os.handler.handlecallback(handler.java:739)             @ android.os.handler.dispatchmessage(handler.java:95)             @ android.os.looper.loop(looper.java:135)             @ android.app.activitythread.main(activitythread.java:5254)             @ java.lang.reflect.method.invoke(native method)             @ java.lang.reflect.method.invoke(method.java:372)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) 

so tried following way:

select * unmapptext updatetime = '0' order updatetime limit 0, 500; 

this gives me result doesn't give result first 500 records gives 500 records results.

you must add order clause make "desc" work:

select * unmapptext updatetime = '0' order "field_name_to_order" desc limit 0, 500; 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -