Is there an easy solution for this?

I'd like to select a single entry from a table and the entries that would be previous and next given to a certain order.

like

select id from mytable where id=45 order by name,name2;

and then I'd like to select the two entries that would come before and after according to the order "name,name2";
id is not ordered, but there is an index on (name,name2) so the needed infomation about previous, next should be stored somewhere in this index.


My current solution is to read all the data without the WHERE-clause and then fetch the needed ones, which is quite time-demanding.

thnx,
peter



--
mag. peter pilsl
goldfisch.at
IT-management
tel +43 699 1 3574035
fax +43 699 4 3574035
[EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to