From: Lloyd Linklater Date: 2008-07-08T08:34:13+09:00 Subject: Re: Fetch 6 records from a table randomly Lloyd Linklater wrote: > As to the question itself, each client server application seems to > implement SQL standards in a non standard way. That is to say that > there is always some proprietary bit here or there. The SQL in oracle > might be: > > select * from mytable where rownum = 123 > > and have the ruby random number generator insert a random value. I have used this differently and found that it is not exactly as I said. The rownum column in oracle exists only in a result set so it will work for row 1 but no other UNLESS... try this: (I am not at a system with oracle but I want to send this before I forget.) select * from (select * from mytable) -- gets it all where rownum = 123 This way, it has a full result set from which to select. Rather clunky but I only looked at this between meetings. -- Posted via http://www.ruby-forum.com/.