Re: sqlplus - compute sum of (colA - colB) on report

From: Richard Kuhler <noone_at_nowhere.com>
Date: Thu, 21 Mar 2002 17:40:56 GMT
Message-ID: <IWom8.52$Q2.163543_at_twister.socal.rr.com>


Alias the computed column and get the sum on the alias

> COMPUTE SUM OF ACCESS_FEE_DIFFERENCE ON REPORT
> AMT_BEFOREACCESS - ACCESS_FEE AS ACCESS_FEE_DIFFERENCE
Richard

Richard Booker wrote:
>
> First and foremost, thanks to all of you for providing and contributing
> to such a useful resource as this newsgroup.
>
> I am trying to include on a report a grand total of the results of
> subtracting one column's value from another.
>
> Below is my best effort. Any help will be greatly appreciated.
>
> SPOOL M:\CCMIS\SQL\REPORT_OF_SUBMITTED_BILLINGS.TXT
> TTITLE 'LIST OF SUBMITTED BILLINGS'
> BREAK ON DEL_AGENCY ON REPORT SKIP 2
> COMPUTE SUM OF (AMT_BEFOREACCESS - ACCESS_FEE) ON REPORT
> SET PAGESIZE 60
> SET LINESIZE 150
> SET NEWPAGE 2
> SELECT
> DEL_AGENCY,
> SITE_NAME,
> AMT_BEFOREACCESS - ACCESS_FEE
> FROM BILLINGS_HEADER
> WHERE MONTH = '02' AND YEAR = '2002' AND SUBMIT_FLAG = 'Y'
> ORDER BY DEL_AGENCY;
> CLEAR COLUMNS
> CLEAR BREAKS
> CLEAR COMPUTES
> TTITLE OFF
> SPOOL OFF
>
> Thanks again.
  Received on Thu Mar 21 2002 - 18:40:56 CET

Original text of this message