Sqlite下一排行为奇怪的Android

h5qlskok  于 2023-06-06  发布在  SQLite
关注(0)|答案(2)|浏览(174)

我有这个查询移动到我的数据库

Select data1,data2 From Table Where counter <"+somenumber+" and  order by counter DESC

这是为了向后移动,我也有同样的,但没有desc为向前移动。问题是这样的:68,69,70,71。为什么要这么做?71分之前是7分。

wlp8pajw

wlp8pajw1#

正如Selvin建议的那样,将你的列改为Integer类型,那么你的order by将正常工作。或者这样做:

Select data1,data2 From Table Where CAST(counter as integer) < 10 order by CAST(counter AS INTEGER) DESC ;
g6baxovj

g6baxovj2#

嘿,检查列类型Text/varchar/not numeric column,还有一件事查询不正确
Select data1,data2 From Table Where condition1 and condition2 order by counter DESC

相关问题