Home » RDBMS Server » Server Administration » restricting rows
restricting rows [message #372346] Sun, 04 February 2001 01:49 Go to next message
selvan g
Messages: 5
Registered: February 2001
Junior Member
I need to know how

to find very first five empoloyees from emp table
thanks
Re: restricting rows [message #372352 is a reply to message #372346] Mon, 05 February 2001 00:54 Go to previous messageGo to next message
Izah
Messages: 1
Registered: February 2001
Junior Member
Try this:
select * from emp_table where rownum <= 5
or
select * from emp_table where rownum between 1 and 5
Re: restricting rows [message #372357 is a reply to message #372346] Mon, 05 February 2001 08:47 Go to previous messageGo to next message
geeselvan
Messages: 1
Registered: February 2001
Junior Member
Object : Restricting rows..

I need first five emoloyee order by join date
from emp table..
if i use Rownum - it is not as per joindate..

So i am thinking to use Rowid- but not..

Expecting.

Thanks
Re: restricting rows [message #372359 is a reply to message #372346] Mon, 05 February 2001 09:06 Go to previous messageGo to next message
Lee
Messages: 56
Registered: May 1999
Member
SELECT * FROM emp
WHERE hiredate >= (SELECT hiredate FROM emp a WHERE 5 = --change the '5' to chose more vals
(SELECT COUNT(DISTINCT(hiredate))
FROM emp b
WHERE b.hiredate > a.hiredate)
AND ROWNUM < 2 AND hiredate IS NOT NULL);
Re: restricting rows [message #372368 is a reply to message #372346] Mon, 05 February 2001 16:47 Go to previous message
Sudhir M. Pongurlekar
Messages: 8
Registered: January 2001
Junior Member
select *
from emp e1
where 5 >
(select count(*)
from emp e2
where e1.sal < e2.sal)
Previous Topic: Index - used/not used!
Next Topic: Same query produces different results
Goto Forum:
  


Current Time: Mon Dec 23 01:02:41 CST 2024