Aug 24, 2000 #1 erwan Programmer Joined Aug 24, 2000 Messages 19 Location FR In sql, i want to get only 10 gretest values on a table . I try with ROWNUM with " where rownum > count(*) -10 but the "order by" is made after the rownum and the result is false. how can i do that. thank you!
In sql, i want to get only 10 gretest values on a table . I try with ROWNUM with " where rownum > count(*) -10 but the "order by" is made after the rownum and the result is false. how can i do that. thank you!
Aug 24, 2000 #2 bigscouse MIS Joined Oct 6, 1998 Messages 420 Location GB the mackpei thread posted 22/8 might help. Upvote 0 Downvote
Aug 25, 2000 #3 buttersoft Programmer Joined Jun 11, 2000 Messages 75 Location CH MAX(fieldname) Upvote 0 Downvote
Aug 30, 2000 #4 cgordon Technical User Joined Oct 8, 2001 Messages 3 Location US In Oracle use a subquery. From the Oracle course: select ename, sal from emp e where 10 > (select count(*) from emp where e.sal < sal) order by e.sal In SQLServer use: select TOP 10 ename, sal from emp order by sal Upvote 0 Downvote
In Oracle use a subquery. From the Oracle course: select ename, sal from emp e where 10 > (select count(*) from emp where e.sal < sal) order by e.sal In SQLServer use: select TOP 10 ename, sal from emp order by sal