Home » SQL & PL/SQL » SQL & PL/SQL » select using rownum
select using rownum [message #273990] Fri, 12 October 2007 10:53 Go to next message
aparna_ora
Messages: 14
Registered: September 2005
Junior Member
hi all
I want to select data from emp table.. I want to retrieve data in range but i dont know the empid's ..
I want to retrieve data from somewhere 100 to 999 but I dont know the empid's .. Using rownum how can i query this?


appu
Re: select using rownum [message #273998 is a reply to message #273990] Fri, 12 October 2007 11:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Yes, you can.

Regards
Michel
Re: select using rownum [message #274083 is a reply to message #273998] Sat, 13 October 2007 10:19 Go to previous messageGo to next message
aparna_ora
Messages: 14
Registered: September 2005
Junior Member
hi can u send me that query?
Re: select using rownum [message #274084 is a reply to message #274083] Sat, 13 October 2007 10:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Can you send what you already searched and tried and why it failed.

Regards
Michel
Re: select using rownum [message #274789 is a reply to message #273990] Wed, 17 October 2007 02:43 Go to previous messageGo to next message
Arju
Messages: 1554
Registered: June 2007
Location: Dhaka,Bangladesh. Mobile:...
Senior Member

order by then rownum.
Re: select using rownum [message #274799 is a reply to message #274789] Wed, 17 October 2007 03:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
order by rownum???
Hahaha! That's a good trick.

Regards
Michel
Re: select using rownum [message #274881 is a reply to message #274789] Wed, 17 October 2007 10:09 Go to previous messageGo to next message
aparna_ora
Messages: 14
Registered: September 2005
Junior Member
I doont think Order by will work. I want range of rownum.
means in between kind of records whose empid i dont know.
I want to retrive records starting from 100 to 999 etc using rownum..
plz can any one suggest me query?

appu
Re: select using rownum [message #274882 is a reply to message #274084] Wed, 17 October 2007 10:14 Go to previous messageGo to next message
aparna_ora
Messages: 14
Registered: September 2005
Junior Member
hi
I used select ename,jobid from emp
where rownum between (100 and 999) kind of query
but with rownum between clause never worked out.
i dont know how to select range of rownum...
Re: select using rownum [message #274890 is a reply to message #274882] Wed, 17 October 2007 10:51 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Search for top-n queries.
Plenty of examples around
Re: select using rownum [message #274913 is a reply to message #274882] Wed, 17 October 2007 12:14 Go to previous message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
aparna_ora wrote on Wed, 17 October 2007 11:14

hi
I used select ename,jobid from emp
where rownum between (100 and 999) kind of query
but with rownum between clause never worked out.
i dont know how to select range of rownum...


This is the equivalent of just
select ename,jobid from emp where rownum <= 900;


999 - 100 + 1 = 900

What do you think the difference between row number 1 and row number 100 is? If you can define that, then Frank's Top-N query can be applied.
Previous Topic: problem with set escape /
Next Topic: How to Save password in **** format in tables (merged)
Goto Forum:
  


Current Time: Thu Dec 05 15:57:48 CST 2024