我有一个SQLite数据库,我试图按字母顺序排序.问题是,SQLite在排序过程中似乎没有考虑A = a,因此我得到如下结果:
A B C T a b c g
我想得到:
A a b B C c g T
我不知道需要做什么特殊的SQL事情?
SELECT * FROM NOTES ORDER BY title
dan04.. 239
你也可以ORDER BY TITLE COLLATE NOCASE
.
编辑:如果你需要指定ASC
或DESC
后添加此NOCASE
像
ORDER BY TITLE COLLATE NOCASE ASC
要么
ORDER BY TITLE COLLATE NOCASE DESC
你也可以ORDER BY TITLE COLLATE NOCASE
.
编辑:如果你需要指定ASC
或DESC
后添加此NOCASE
像
ORDER BY TITLE COLLATE NOCASE ASC
要么
ORDER BY TITLE COLLATE NOCASE DESC
您可以将所有内容转换为小写以进行排序:
SELECT * FROM NOTES ORDER BY LOWER(title);
如果你想确保大写字母仍然在小写字母之前结束,只需将其添加为辅助排序:
SELECT * FROM NOTES ORDER BY LOWER(title), title;