Column 1: Date
Column 2: Type
因此,如果行按降序排序Date
,则查找用户具有相同连续类型的日期"Clever"
(参见下面的示例)。
例如:
如果我的表包含以下数据-
Sr Date Type
1 2013-05-24T16:21:06.728Z Alaska
2 2013-05-27T20:44:32.412Z Clever
3 2013-05-27T20:45:33.301Z Clever
4 2013-05-27T21:45:46.127Z Clever
5 2013-05-27T21:46:27.825Z Self
6 2013-05-28T15:18:48.430Z 聪明
所以我想要日期2013-05-27T21:45:46.127Z
我尝试了以下 -
ArrayList<String> startTimeList = new ArrayList<String>();
cur = dbAdapter.rawQuery("select Date, Type from User ORDER BY Date DESC", null);
cur.moveToFirst();
if(cur.getCount() > 0)
{
int i = 0;
while(cur.isAfterLast() == false)
{
if(cur.getString(1).equals("Clever"))
{
startTimeList.add(cur.getString(0));
cur.moveToNext();
}
else
{
cur.moveToNext();
}
if(startTimeList.size() == 2)
{
return;
}
}
但这并没有给我Date
类型为的连续行"Clever"
。