SQLite查询-以数字顺序排列结果 [英] Sqlite query - order results with numbers last
本文介绍了SQLite查询-以数字顺序排列结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想执行一个SQLite查询,并以数字的顺序对结果进行排序.
I would like to perform an SQLite query and order my results with numbers last.
例如:
当我在文本字段上指定ASC时,SQLite通常会按以下顺序排序结果:
SQLite will ordinarily order results like this when I specify ASC on a text field:
0, 1, 2, 一种, B, C
0, 1, 2, A, B, C
我想这样:
A, B, C, 0, 1, 2
A, B, C, 0, 1, 2
有什么想法吗?这可能吗?
Any ideas? Is this possible?
谢谢!
尼克.
推荐答案
我对sqllite一无所知,但是类似的东西应该可以工作(当然,假设有某种isnumeric
函数可用):-
I know nothing about sqllite, but something like this should work (assuming, of course, that there is some sort of isnumeric
function available):-
order by isnumeric(colA), colA
以使您的非数字优先显示.
so that your non-numerics appear first.
这篇关于SQLite查询-以数字顺序排列结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文