Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 04 Feb 2011 @ 08:57:50 GMT


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


Subj:   Re: Avoid distinct
 
From:   Minakshi Swami

Hi,

You can do it with partition clause, here is the syntax

     sel c1,sum(c2),count(c3),count(c4) over(partition by c1 order by 1)
       from vt1 group by c1,c4;

The output will be same as your sql

     sel c1,sum(c2),count(c3),count(distinct c4)  from vt1 group by c1


     
  <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