hai , try this for emp in scott select sum(sal) from ( select rownum,empno,sal from ( select EMPNO,nvl(SAL,0) sal from emp order by sal desc ) where rownum <= 3 )
Regards Binu On 10/7/08, Binu K S <[EMAIL PROTECTED]> wrote: > > hai, > can u explain it with some sample data . > Regards > Binu > > > On 10/7/08, weird0 <[EMAIL PROTECTED]> wrote: >> >> >> How can i calculate the sum of top 3 records in pl/sql ?? >> >> I able to sum up all of the records by using sum() aggregate function >> and group by, but how do i restrict it to only top 3. >> >> Regards >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---