Ich habe eine Tabelle Geschichte.SQLite Android Zählung nach Name
History-Tabelle hat drei Spalten
ID | timestamp | imagename
Ich brauche alle Bilder zu zählen, wo Namen wie Name, den ich mich darauf, von meiner app
Beispiel
1 | 12.12.2019 | 88801
2 | 11.11.2019 | 88802
3 | 13.1.2019 | 88802
4 | 1.2.2015 | 88801
5 | 7.8.2019 | 88801
i wie dies zur Folge haben müssen
Image name| number of images
8801 | 3
8802 | 2
...
Ich muss es durch Weiterleiten Variable ImageName zählen.
Das ist, was ich jetzt
public List<HistoryLog> getAllHistoryLogsForListView(String imageName) {
List<HistoryLog> historyLogList = new ArrayList<>();
// Select All Query ORDER BY Timestamp | SORT ASC | LIMIT 150 rows
String selectQuery = "SELECT * FROM " + TABLE_HISTORY + " ORDER BY " + KEY_TIMESTAMP + " ASC " + " LIMIT 150";
SQLiteDatabase db = this.getWritableDatabase();
db.beginTransaction();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
HistoryLog historyLog = new HistoryLog();
historyLog.setId(Integer.parseInt(cursor.getString(0)));
historyLog.setTimeStamp(cursor.getString(1));
historyLog.setImageName(cursor.getString(2));
// Adding history logs to list
historyLogList.add(historyLog);
} while (cursor.moveToNext());
}
db.endTransaction();
// return history logs list
return historyLogList;
}
nicht klar, was Sie eigentlich wollen? –
Ich möchte wissen, wie viele Bilder denselben Namen haben, ich muss es zählen – Adnan