On Fri, Nov 5, 2010 at 8:25 AM, bertly_the_coder <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to