Android SQLite not Sorting



你知道我对SQLite结果排序的尝试有什么问题吗?

我在Java (Android)上是这样做的:

return database.query("tools", new String[] {"_id","title"}, null, null, null, null, "title Asc");

相信,我已经试过了:

SELECT _id, title FROM tools ORDER BY title ASC

但是在这两种方式中,SQL结果都是按字段_id ASC排序的!

不知道该做什么了。

感谢

[[编辑]]

我看了我的结果,我猜是怎么回事。

_id          title
 1            test
 2            Ábc
 3            Abcd

标题有特殊字符

我得到了错误。我的标题字段有重音

这里描述的问题:按带有重音字符(Á)的列排序sqlite的问题

:

SELECT _id, title FROM tools ORDER BY title ASC
:后

SELECT _id, title FROM tools ORDER BY title COLLATE UNICODE ASC

注意"COLLATE UNICODE"忽略当前语言环境。结构必须是:

, 整理UNICODE (ASC/DESC)

参考文献:
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

最新更新