I have a dataset, which contains a day column that I would like to retrieve results on. Is there any reason why daily_stats.where(''day Date(?)'', dte).first returns and empty set, daily_stats.find(:first, :conditions => [''date(day) = ?'', dte]) returns the correct data and daily_stats.where({:created_at => (date.midnight - 1.day)..date.midnight}).first returns the wrong data(returns data the for the day before)? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Nov 5, 2010 at 8:25 AM, bertly_the_coder <muchira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a dataset, which contains a day column that I would like to > retrieve results on. Is there any reason why daily_stats.where(''day > Date(?)'', dte).first returns and empty set, > daily_stats.find(:first, :conditions => [''date(day) = ?'', dte]) > returns the correct data and daily_stats.where({:created_at => > (date.midnight - 1.day)..date.midnight}).first returns the wrong > data(returns data the for the day before)?Aren''t the queries you posted totally different ones? "WHERE DATE(:dte) day" is different from "DATE(day) = :dte" -- Erol M. Fornoles http://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Shoot....typo...going to repost it On Nov 4, 9:19 pm, Erol Fornoles <erol.forno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Nov 5, 2010 at 8:25 AM, bertly_the_coder <much...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have a dataset, which contains a day column that I would like to > > retrieve results on. Is there any reason why daily_stats.where(''day > > Date(?)'', dte).first returns and empty set, > > daily_stats.find(:first, :conditions => [''date(day) = ?'', dte]) > > returns the correct data and daily_stats.where({:created_at => > > (date.midnight - 1.day)..date.midnight}).first returns the wrong > > data(returns data the for the day before)? > > Aren''t the queries you posted totally different ones? "WHERE DATE(:dte) > day" is different from "DATE(day) = :dte" > > -- > Erol M. Fornoleshttp://github.com/Erolhttp://twitter.com/erolfornoleshttp://ph.linkedin.com/in/erolfornoles-- 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.