Re: Sorting on a calculated field

From: Andre Vergison <avergison_at_infosoft.be>
Date: 1995/12/06
Message-ID: <4a3qcc$e2o_at_news.Belgium.EU.net>#1/1


Maybe you can solve your problem with SQL.

First, obtain the overall-total. Say this is stored in GENTOT.

Then, the following query would return the information you want:

select DI.drug_class, MT.drug_type,

       sum( MT.costcol1 + MT.costcol2 + MT.costcol3 ) TYPECOST
       to_char( sum( MT.costcol1 + MT.costcol2 + MT.costcol3 )
                * 100 / :GENTOT,
                '990.00') perc

 from drug_info DI, main_table MT
 where DI.keycolumn = MT.drug_info_column  group by DI.drug_class, MT.drug_type
 having sum( MT.costcol1 + MT.costcol2 + MT.costcol3 ) <> 0  order by TYPECOST;

Gerard H. Pille, Infosoft, ghp_at_infosoft.be Received on Wed Dec 06 1995 - 00:00:00 CET

Original text of this message