Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Next and Previos Row in the Table
Hi,
select * from emp_table
where EMPLOYEE_ID in (
888,
(select min(EMPLOYEE_ID) from a where EMPLOYEE_ID>888),
(select max(EMPLOYEE_ID) from a where EMPLOYEE_ID<888)
)
Regards,
-- Roman Mirzaitov Brainbench MVP for Oracle Administration www.brainbench.com "Munda" <munda_73_at_yahoo.com> wrote in message news:c2b0e26b.0206101233.67d75be5_at_posting.google.com...Received on Mon Jun 10 2002 - 21:58:09 CDT
> I have a employee table as following
> EMPLOYEE_ID Number
> EMPLOYEE_NAME VARCHAR2(20)
>
> For example consider table has following data
>
> EMPLOYEE_ID EMPLOYEE_NAME
> 111 a
> 333 c
> 555 e
> 666 f
> 888 h
> 999 i
>
>
> I want to display Previous and Next record for the specific Employee .
> For Example
> If I the specified employee id is 888 then I will need employee 666 and
999
> I want these in single SQL .
> Please email me back @ munda_73_at_yahoo.com
> Help will be greatly appreciated
![]() |
![]() |