From: <li...@li...> - 2001-02-07 17:27:44
|
It's been rumoured that Roderick A. Anderson said: > PostgreSQL does have the limit clause which I believe is in the SQL92 and > SQL99 standards. It's easy to get into the MySQL (choose your own > database) has this feature or that thingy but for the most part PostgreSQL > follows the standands better than the other databases. > > The problem with the limit statement is it is 'stateless'. It picks > the first 'n' records that meet the rest of the selection criteria. > There is no easy way to remember the current 'n' items at the database > level so the the next SELECT statement can pick the next 'n' items. Not true: use cursors. DECLARE cursorname CURSOR FOR query; FETCH count FROM cursorname; allows you to pick the next n items forward, back, relative, absolute. etc. its in postgres. Note cursors suck for update, because if someone else inserted a record into the set of N you are looking at with a cursor, things get confusing as you scroll around. --linas |