0

WHERE 句を使用してすべてのレコードを昇順で取得したい。しかし、クエリのどこに WHERE 条件を含めればよいでしょうか? 昇順で問題なく動作しています。

これが私のコードです。最初にこのクエリに取り組んでいますが、ここでは ORDER BY 句を実装できません。

Cursor tripdaycursor = sdb.rawQuery(
  "select TripDay_Id, Tripday_Date, Tripday_ParsingDate,
  Trip_Complete, TripDay_Endkm, TripDay_Count, Tripday_EndPlace
  FROM TripDay WHERE Trip_Id="+record, null);

だから私は昇順のために以下のコードを試しました:

String recordid=Integer.toString(record), Trip_Id="Trip_Id", TripDay_Id="TripDay_Id",
  Tripday_Date="Tripday_Date", Tripday_ParsingDate="Tripday_ParsingDate",
  Trip_Complete="Trip_Complete", TripDay_Endkm="TripDay_Endkm",
  TripDay_Count="TripDay_Count", Tripday_EndPlace="Tripday_EndPlace",
  TripDay = "TripDay";
Cursor tripdaycursor = sdb.query(TripDay, new String[] {
  TripDay_Id, Tripday_Date, Tripday_ParsingDate, Trip_Complete, TripDay_Endkm,
  TripDay_Count, Tripday_EndPlace}, null, null, null, null,
  Tripday_ParsingDate + " ASC");

しかし、WHERE 句を使用して昇順で、単一のクエリで両方の条件が必要です。どうやってするか?

4

1 に答える 1

0

where句の後にクエリの「orderbyColumn_Name」を入れることができます。このようなもので、昇順で並べ替えたい列があります

Cursor tripdaycursor = sdb.rawQuery("select TripDay_Id,Tripday_Date,Tripday_ParsingDate,Trip_Complete,TripDay_Endkm,TripDay_Count,Tripday_EndPlace from TripDay where Trip_Id="+record + " order by " + columnName,null);
于 2013-01-10T06:38:59.470 に答える