data type mismatch error when using ORDER BY

后端 未结 5 2036
天涯浪人
天涯浪人 2021-02-05 02:19

I\'ve got an android app using a local sqlite database.

private SQLiteDatabase mDb;

when I run this query I get my Cursor over rows with pid eq

5条回答
  •  你的背包
    2021-02-05 02:47

    It looks like you got just a little mixed up. According to the SQLiteDatabase.query documentation, the last argument is the LIMIT clause. The second to last is the ORDER BY clause.

    Cursor query (boolean distinct, 
                String table, 
                String[] columns, 
                String selection, 
                String[] selectionArgs, 
                String groupBy, 
                String having, 
                String orderBy, // <-- ORDER BY
                String limit)
    

    EDIT

    But, there is also another SQLiteDatabase.query where ORDER BY would be last

    Cursor query (String table, 
                String[] columns, 
                String selection, 
                String[] selectionArgs, 
                String groupBy, 
                String having, 
                String orderBy)
    

提交回复
热议问题