开发者

iPhone sqlite desc vs asc?

开发者 https://www.devze.com 2022-12-19 15:43 出处:网络
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???Becaus

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

精彩评论

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

关注公众号