From 4807088fda43b5858ada61e822c7598e17c83417 Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Thu, 26 May 2011 20:52:22 -0400 Subject: [PATCH] Don't you lie to me! --- railties/guides/source/active_record_querying.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 579a323d57..6cba34c7cd 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -483,13 +483,13 @@ SQL uses the +HAVING+ clause to specify conditions on the +GROUP BY+ fields. You For example: -Order.group("date(created_at)").having("created_at > ?", 1.month.ago) +Order.group("date(created_at)").having("created_at < ?", 1.month.ago) The SQL that would be executed would be something like this: -SELECT * FROM orders GROUP BY date(created_at) HAVING created_at > '2009-01-15' +SELECT * FROM orders GROUP BY date(created_at) HAVING created_at < '2009-01-15' This will return single order objects for each day, but only for the last month.