GROUP BY
当我在android中使用时,这段代码有什么问题 。请在 sqlite 中测试此代码:
public void getPlayerName_OrderBy(int First_TeamID)
{
int Match_ID = get_MatchID();
int matchId;
int teamID;
int PlayerID;
String Name;
if(Player_SD != null)
Player_SD.clear();
String selectQuery = "SELECT "+ STStrikerPlayerName+", count +"("+STStrikerPlayerName+")" +" FROM " +TABLE_SCORE+" where "+ STMatchID +" = '"+ Match_ID +"'"+" AND " +STFristTeamID + "= '"+First_TeamID+"'"+" GROUP BY "+STStrikerPlayerName;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Player_score_details psd = new Player_score_details();
matchId = Integer.parseInt(cursor.getString(0));
teamID = Integer.parseInt(cursor.getString(1));
PlayerID = Integer.parseInt(cursor.getString(3));
Name = cursor.getString(20);
} while (cursor.moveToNext());
}
db.close();
}