Re: Percentages in SQL?

From: branigan d <p0054467_at_oxford-brookes.ac.uk>
Date: 25 Jan 1994 12:16:51 -0600
Message-ID: <CK70or.5Eq_at_uk.ac.brookes>


   You could always try using the "new_value" in SQL*PLUS.    The following sets up a 'variable' c2, the second select calculates averages    and the final select shows the actual count. Hope it helps.

      column c1 new_value c2

      select count(*) c1
      from tab;

      select count(tabtype) / &&c2 * 100
      from tab
      group by tabtype;

      select count(tabtype)
      from tab
      group by tabtype;


_______________________________________________________________________________
Damian Branigan (Project Leader ISS) d.branigan_at_brookes.ac.uk "So free we seem, so fettered fast we are." RB
_______________________________________________________________________________
Received on Tue Jan 25 1994 - 19:16:51 CET

Original text of this message