So Postgres is complaining about:
PGError: ERROR: column "sessions.created_at" must appear in the GROUP BY clause or be used in an aggregate function
But the trouble is, "created_at" does appear in the group by clause:
SELECT created_at, count(id) as visit_count FROM "sessions" WHERE ("sessions"."site_id" IN (4, 3)) AND ("sessions"."created_at" >= '2011-10-20 00:00:00.000000') AND ("sessions"."created_at" <= '2011-10-27 23:59:59.999999') GROUP BY date(created_at))
Does it have something to do with created_at being wrapped in date() perhaps?
Thanks in advance!