From: Carlos Date: 2004-07-22T02:39:41+09:00 Subject: Re: ruby postgresql question [Mark Firestone , 2004-07-21 17.45 CEST] > Well, messages get deleted, but the message numbers in the table don't > change. The message numbers (when you are reading them) *do* change because > they are always 1.. so the system needs to know which > actual message to pull up when you type it's number in. They won't be the > same, after one message is deleted. So I am doing a ... > > > for row in @db.query("SELECT number FROM #{table} ORDER BY number") > hash << row[0].to_i > end > > and making an array, full of message numbers. A lookup table. So I can > look up which message to pull up. In postgresql you can use the OFFSET and LIMIT modifiers. For example SELECT * FROM table ORDER BY number OFFSET #{nth_row} LIMIT 1 retrieves the nth row. --