title: How do i divide by an Alias?
body: <p>When I run the follwing query I get a ORA- 00937 error.</p>
  
  <pre><code>select apex_utilities.get_invtype(o_code)
  ,count(c.id) as "Case Count"
  ,round(sum(billable_time/3600),2) as "Time(hrs)"
  ,round(sum(billable_time/count(c.id)),2) as "AHT(secs)"
  from        myTable c
  where c.date_created between :p31_period_start and add_months(:p31_period_start,1)
  group by rollup(apex_utilities.get_invtype(o_code));
  </code></pre>
  
  <p>If I comment out the line </p>
  
  <pre><code>    ,round(sum(billable_time/count(c.id)),2) as "AHT(secs)"
  </code></pre>
  
  <p>it runs as expected, without this column appearing.</p>
  
  <p>How do i get it to run including this line? If I add billable_time to the group by then the output is incorrect as I get many rows as it groups all the billable_time as well as the invtype. In addition i have to remove the 'SUM' from the line to get it to run.</p>
  
  <p>The output I am looking for is similar to the following</p>
  
  <pre><code>invtype    CaseCount    Time(Hrs)    AHT(secs)
  CDCW          1234       308:53:45   909.56
  CBCB          100        24:56:34    109.24
  </code></pre>