Need to show a SQLite query in descending order

前端 未结 4 1345
再見小時候
再見小時候 2020-12-20 12:26

I want to make a query such that the result will be shown in indistinct descending order.

For example, assume column ID has six rows. I need an quer

相关标签:
4条回答
  • 2020-12-20 12:45

    You need to add an ORDER BY ID DESC to your select statement.

    ORDER BY

    0 讨论(0)
  • 2020-12-20 12:47

    You can write like this:

    Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_NAME+" 
                    WHERE "+STATUS+" = "+"'0'" + " ORDER BY id DESC LIMIT 10", null);
    return cursor ;
    
    0 讨论(0)
  • 2020-12-20 12:53

    Use following statement....

    select * from YOUR_TABLE_NAME ORDER BY ID  DESC;
    
    0 讨论(0)
  • 2020-12-20 13:00

    /* In the most simple and basic way, you can write it as */

    SELECT ID FROM your_table_name ORDER BY ID DESC;

    /* This should work fine with your problem and should give you your desired output */

    0 讨论(0)
提交回复
热议问题