I think this SQL would do it:
SELECT *
FROM `states`
WHERE created_at < '2010-04-16'
OR created_at = (
SELECT created_at
FROM `states`
ORDER BY created_at ASC
LIMIT 1)
ORDER BY created_at DESC
LIMIT 1
But your original solution would be easier to maintain!
--
Posted via http://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 [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.