Saya akhirnya menggunakan solusi yang menggabungkan variabel, berdasarkan jawaban Stack Overflow yang diposting di sini . Solusi ini tampaknya sedikit lebih fleksibel dan efisien daripada jawaban lain yang diberikan.
SELECT u.date,
@running_total := @running_total + u.count AS count
FROM (
SELECT COUNT(*) AS count, DATE_FORMAT(FROM_UNIXTIME(created), '%b %d %Y') AS date
FROM {users}
WHERE created >= :start_time AND created <= :end_time
GROUP BY YEAR(FROM_UNIXTIME(created)), MONTH(FROM_UNIXTIME(created)), DAY(FROM_UNIXTIME(created))
) u
JOIN (
SELECT @running_total := u2.starting_total
FROM (
SELECT COUNT(*) as starting_total
FROM {users}
WHERE created < :start_time
) u2
) initialize;
Perhatikan bahwa persyaratan grup menurut, pemformatan tanggal, dan rentang hanyalah spesifik dari proyek khusus saya. Bentuk yang lebih umum dari solusi ini (sesuai pertanyaan awal) adalah:
SELECT u.date,
@running_total := @running_total + u.count AS count
FROM (
SELECT COUNT(*) AS count, DATE(FROM_UNIXTIME(created)) AS date
FROM {users}
GROUP BY date
) u
JOIN (
SELECT @running_total := 0
) initialize;