Home » SQL & PL/SQL » SQL & PL/SQL » get data between rows (oracle 10g)
get data between rows [message #601726] Mon, 25 November 2013 00:58 Go to next message
hp345
Messages: 5
Registered: November 2013
Junior Member
how to get data between particular no. of rows?
like... i have party table and i want data between row num 10 to row num 30 in this table.....
what should be command for this?
Re: get data between rows [message #601729 is a reply to message #601726] Mon, 25 November 2013 01:24 Go to previous messageGo to next message
hp345
Messages: 5
Registered: November 2013
Junior Member
well i have tried following statements...

select * from party
where rownum between (select * from party where rownum <10)
and (select * from (select * from party order by rownum desc) where rownum <=10);


select party_id, company_name, contact_name from party
where rownum between 10 and 30

but can't get this....

Re: get data between rows [message #601733 is a reply to message #601726] Mon, 25 November 2013 02:08 Go to previous messageGo to next message
Michel Cadot
Messages: 59295
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Can one retrieve only rows X to Y from a table?

Re: get data between rows [message #601742 is a reply to message #601733] Mon, 25 November 2013 03:52 Go to previous messageGo to next message
hp345
Messages: 5
Registered: November 2013
Junior Member
Got the solution ......

select party_id, company_name, contact_name
from
(
select party_id, company_name, contact_name, rownum as rnum
from party
)
where rnum between 10 and 30;
Re: get data between rows [message #601743 is a reply to message #601742] Mon, 25 November 2013 03:54 Go to previous messageGo to next message
hp345
Messages: 5
Registered: November 2013
Junior Member
Thanks to all..Smile
Re: get data between rows [message #601745 is a reply to message #601743] Mon, 25 November 2013 04:08 Go to previous messageGo to next message
pablolee
Messages: 2634
Registered: May 2007
Location: Scotland
Senior Member
Just remember that this is a random set of rows
Re: get data between rows [message #601748 is a reply to message #601745] Mon, 25 November 2013 04:34 Go to previous message
hp345
Messages: 5
Registered: November 2013
Junior Member
yup...temp. i need this...thanks.
Previous Topic: How To question for analytics
Next Topic: split string in two halves
Goto Forum:
  


Current Time: Thu Oct 02 06:27:47 CDT 2014

Total time taken to generate the page: 0.07273 seconds