Hi,
My knowledge of PostgreSQL's SQL is not good, but I know ISO/ANSI
SQL:2003 (basics) quite well.
I've encountered with following task. I have one SELECT statement with
ORDER BY clause; and know, that result set for this SELECT contains
row with ID = 1000 (just for example).
I don't know the position of this row in result set, but I want to
retrieve 2 rows that are next to this one.
First of all, I don't want (cannot) write PL/pgSQL function.
So, I should use CREATE TEMP SEQUENCE to associate all rows in result
set with their order numbers (in MySQL. for example, I would use
temporary variable num in SELECT: something like 'select @num := @num
+ 1', but here I cannot, can't I?)
Then, as I know, PostgreSQL doesn't support standard statement WITH,
that probaby would help me with this task.
Any ways to solve this problem? Is it possible to make only one query?
(at least with one row in result set - e.g., with the row _following_
after my one)
I'd appreciate any help.
--
Best regards,
Nikolay