Re: Reports 6i How to sort records by summarized fields

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Thu, 11 Mar 2004 07:30:14 -0500
Message-ID: <XqidnYkeROJ_xs3dRVn-vg_at_comcast.com>


"Tamer" <rookiedba_at_hotmail.com> wrote in message news:e91bf6a5.0403110045.13649346_at_posting.google.com...
| >
| > since reports doesn't give you the break-order property for summary
columns,
| > it looks like you'll have to include a summary column (group by syntax)
in
| > the query rather than rely on reports to produce the summary
| >
| > ;-{ mcs
|
| First of all, thanks for answering.
|
| Well I use that solution for some reports but this time I also have to
| show the details. How can I show details, summary of some fields of
| these detail records and sort them by these summary fields? This is
| the question.
| I just want to be sure whether there is a solution or not...
|
| Tamer.

inline view (from-clause subquery):

select e.deptno, s.avg_sal, e.ename, e.empno, e.sal, e.sal-s.avg_sal as diff from emp e

       , (
       select deptno, round(avg(sal)) as avg_sal
       from   emp
       group by deptno
       ) s

where e.deptno = s.deptno
order by avg_sal desc
/

;-{ mcs Received on Thu Mar 11 2004 - 13:30:14 CET

Original text of this message