ROWNUM is a pseudocolumn, it's not a real column;
it's assigned in the query result, starting from 1;
so,
select * from table where rownum > 1
will always return empty result;
and to get top N result in ordered result (like the LIMIT in mysql), you will need to use sub-query like:
select * from (select * from table order by col ) where rownum < 10
if you just use
select * from table order by col where rownum < 10
you will get 10 result, but not the top 10 ones in the ordered list as you expect
Friday, October 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment