|
-
no of rows ... order by
hi
just wanted to add my two bit ... the order by clause will *not* be used in the rownum part of the query
select * from
( select a.*, rownum rnum from
( YOUR_QUERY_GOES_HERE
-- including the order by ) a
where rownum <= 55 )
where rnum >= 35
this will fetch the rows from 35 to 55
Thus the rows are "ordered" before we use the Order By
These topN queries have become even easier with 8i rel2 with the analytic functions
for example
SELECT ename , deptno, sal,
RANK() OVER (PARTITION BY deptno ORDER BY sal DESC)
FROM emp;
Try them out very *cool*
Charanjiv
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
|