-
Ask for between row selection
Dear all,
We have 100 records(tbl_name), now we create the 4 views(viw_1, viw_2, viw_3, viw_4) for each 25 records. It means 1st is first top 25, 2nd is second top 25 and so on.
Can u help me?
Thx
-
You will have to use 'top n' query. Syntax can be found in Oracle documentation.
A crude method is to use the ROWNUM pseudocolumn. Eg Select * from your_table where rownum between 25 and 50;
-
or you could use the row_number() analytical function
HTH
Gert
-
Originally posted by Raminder
A crude method is to use the ROWNUM pseudocolumn. Eg Select * from your_table where rownum between 25 and 50;
I don't see how this would be defined as 'crude', as this is the proper way to do 'windowing', which is very similar to this request.
However, I must ask - why in the world do you want to do this at all? It is a very odd request.
- Chris
-
------------------
However, I must ask - why in the world do you want to do this at all? It is a very odd request.
-------------------
I use it quite regularly where the client requires the data to be seperated in 4-5 sets and then apply different rules on each set.
You can do it as
select *
from ( select a.*, rownum rnum
from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
where rownum <= MAX_ROWS )
where rnum >= MIN_ROWS
-- Anurag.
OCP Application Developer
---------------------------------------------------------
"Be not afraid of growing slowly. Be afraid only of standing still."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|