Android选择多条记录

时间:2014-05-17 19:21:11

标签: android sqlite select rows

用这个查询我选择一条记录,现在我想选择带有下一个ID的记录,所以我应该把这两个SELECT结合起来,我该怎么办?

String sql ="SELECT _id, date, score, score1 FROM Points 
WHERE score = '"+score_ricevuto+"' ORDER BY date DESC";

String sql ="SELECT _id, score, score2 FROM
 Points WHERE score = '"+score_ricevuto+"';

2 个答案:

答案 0 :(得分:0)

像这样:

SELECT _id, date, score, score1, score2 
  FROM Points 
 WHERE score = '"+score_ricevuto+"' 
 ORDER BY date DESC";

答案 1 :(得分:0)

这是选择多个记录的更好方法。

SELECT _id, date, score, score1 FROM Points  WHERE score = '"+score_ricevuto+"' and _id IN (" + id + "," + (id+1) + " ORDER BY date DESC";