From: david Date: 2006-05-02T14:05:41+09:00 Subject: Re: Find the 3 newest rows in the database Pistos Christou wrote: > david wrote: >> I have an Adverts table with a created_at column. I would like to get >> back the 3 newest adverts. How would I do this. > > This depends on what you're using, but it's a relatively simple SQL > statement: > > SELECT * > FROM adverts > ORDER BY created_at DESC > LIMIT 3; > > Are you using DBI? Straight SQL? ActiveRecord? Og? > > Pistos ActiveRecord -- Posted via http://www.ruby-forum.com/.