What was in your :order argument?
Did you specify it as :order => "to_char(created_at,
''YYYYMMDD00000'')" ?
On Mar 2, 12:51 pm, Chris Kalaboukis
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> Hi guys: Having this strange problem using Rails on Postgres. I''m
trying
> to count up the records that match a certain created_at date, but they
> don''t seem to be grouping in order. Tip: this worked fine in
MySQL, but
> I need to use Heroku, which is Postgres only....
>
> Here is my query:
>
> @graphdata = Capture.count(:group =>
> "to_char(created_at,''YYYYMMDD000000'')",
:conditions => "created_at
> between ''"+@rangestart+"'' and
''"+@rangeend+"'' and
("+@searchterms+")",
> :select => "created_at")
>
> But when I try to output this, the order is all wonky:
>
> 20100302000000:994<
> 20100222000000:2964<
> 20100227000000:4853<
> 20100301000000:7143<
> 20100226000000:5340<
> 20100223000000:3517<
> 20100221000000:196<
> 20100225000000:4485<
> 20100224000000:4068<
> 20100228000000:15335<
>
> Any ideas? I tried adding :order to the query and it broke...
>
> Thanks...Chris
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.