我有一个带浮动值的光标,用以kg为单位描述我的人体重量。
所以我数据库中的所有人都有这样的表情:
NAME - WEIGHT:
John: 85.3
Michael:80.3
Lisa 58.2
Christopher: 75.0
我想要做的是按重量范围在ListView中显示它们。
"50-60": 1 people
"60-70": 1 people
"70-80": 2 people
"80-90": 0 people
我计划使用带有SimpleCursorAdapter的ListView,但我不知道如何对它们进行分组......
非常感谢你的帮助
答案 0 :(得分:1)
有些事情:
select
sum(case when weight > 60 and weight <= 70 then 1 else 0 end) as weight1,
sum(case when weight > 60 and weight <= 80 then 1 else 0 end) as weight2
from myTable