开发者

iPhone sqlite desc vs asc?

How come in my code when i use @"select Score from tblMed order by Score desc limit 10" everyth开发者_运维百科ing works fine, but when I change "desc" to "asc" the scores don't show up???


Because:

ORDER BY score ASC

...means that the lowest values will be at the top of the list - adding LIMIT 10 to the query will return the first 10 records with the lowest scores, so I imagine you have entries with score values of zero and/or null.


Do you have NULL scores in your records?

If you change the ordering to asc, then it would start with NULLs before selecting records with an actual value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜