![]()  |  
 
 
 | 
Archives of the TeradataForumMessage Posted: Wed, 07 Nov 2007 @ 21:50:18 GMT
 
 Depending on table size and indexes, you might also try this: 
     select office, office_total, office_total/sum(office_total) over ()
     pct_of_all_offices
     from (
     select office, sum(hours) office_total
     from table
     group by 1) x
This only requires one pass through the table. Just watch out that you don't end up trying to divide integers.... Dave Curley 
  | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
 
  | ||||||||||||||||||||||||||||||||||||||||||||||||
|  
 | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||