Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 07 Nov 2007 @ 19:39:09 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Calculate Percentages for a column
 
From:   frank.p.oconnor

Oscar

This can be achieved by the use of derived tables as below:

     **
     *SELECT* A1.OFFICE, SUM(A1.HOURS) *AS* HOURS
     , SUM(A1.HOURS) / A2.totalhours *AS* HRSPCT
     **
     *FROM* *TABLE* *AS* A1
     , (*select* sum(hours) *from* *table*) a2 (totalhours)
     **
     *WHERE* A1.OFFICE *LIKE* 'AD%'
     **
     *GROUP* *BY* A1.OFFICE;

Good luck,

Frank



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023