mercredi 28 janvier 2015

SQLiite: Get average number of table entries per day

My SQLite table contains a column called "date". A possible entry could look like 2015-01-28 10:19:48. Now i want to read the average number of table entries per day. My query looks like the so far:



String rawQuery = "SELECT AVG(a.count) AS avg FROM (SELECT COUNT(*) AS count, DAY(" + TLeaks.COLUMN_DATE + ") as day FROM " + TTable.TABLE_NAME + " WHERE " + TTable.ID + " = ? GROUP BY day) AS a";


I seems there no function DAY in SQLite. How would this query look like for Android?


Aucun commentaire:

Enregistrer un commentaire