SELECT COUNT(id), created_at FROM table GROUP BY created_at
SELECT DATE(FROM_UNIXTIME(`created_at`)) AS thedate, MAX(count) FROM analytics WHERE DATE(FROM_UNIXTIME(CURRENT_TIMESTAMP)) = DATE(FROM_UNIXTIME(`created_at`)) GROUP BY DATE(FROM_UNIXTIME(`created_at`))
UNION ALL
SELECT DATE(FROM_UNIXTIME(`created_at`)) AS thedate, MAX(count) FROM analytics WHERE DATE(FROM_UNIXTIME(CURRENT_TIMESTAMP - day)) = DATE(FROM_UNIXTIME(`created_at`)) GROUP BY DATE(FROM_UNIXTIME(`created_at`))
UNION ALL
SELECT DATE(FROM_UNIXTIME(`created_at`)) AS thedate, MAX(count) FROM analytics WHERE DATE(FROM_UNIXTIME(CURRENT_TIMESTAMP - 2days)) = DATE(FROM_UNIXTIME(`created_at`)) GROUP BY DATE(FROM_UNIXTIME(`created_at`))
UNION ALL
SELECT DATE(FROM_UNIXTIME(`created_at`)) AS thedate, MAX(count) FROM analytics WHERE DATE(FROM_UNIXTIME(CURRENT_TIMESTAMP - 3days)) = DATE(FROM_UNIXTIME(`created_at`)) GROUP BY DATE(FROM_UNIXTIME(`created_at`))
UNION ALL
SELECT DATE(FROM_UNIXTIME(`created_at`)) AS thedate, MAX(count) FROM analytics WHERE DATE(FROM_UNIXTIME(CURRENT_TIMESTAMP - 4days)) = DATE(FROM_UNIXTIME(`created_at`)) GROUP BY DATE(FROM_UNIXTIME(`created_at`))