Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 06 Nov 2007 @ 23:29:05 GMT


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


Subj:   Re: Calculate Percentages for a column
 
From:   Michael Larkins

Oscar:

You cannot put a SELECT in a SELECT. It can however be in the FROM. Try something like this:

          > SELECT A1.OFFICE, SUM(A1.HOURS) AS HOURS, (SUM(A1.HOURS) / tot_hrs as hrspct
          > FROM TABLE AS A1, (SELECT
          > SUM(HOURS) FROM TABLE) dt (tot_hrs)
          > WHERE A1.OFFICE LIKE 'AD%'
          > GROUP BY A1.OFFICE;

Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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