Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 05 Sep 2002 @ 16:49:30 GMT


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


Subj:   Re: Help on CASE Statement
 
From:   Shridhar Suvarna

Try the below query I think it should work. Good Luck ! Oh BTW I am not a Guru.

--Shridhar Suvarna

Select
 Line_Month
,Count(*)
From
(Select
 ,Cust_Id
 ,Cust_Line_Seq_Id
 ,Extract (Month from Line_Act_Dt) Line_Month
 ,Sum((Case when Extract(Month from Cycle_Dt) in (4, 6) then 1 Else 0 End)) Tot_Cyc1
 ,Sum((Case when Extract(Month from Cycle_Dt) in (5, 7) then 1 Else 0 End)) Tot_Cyc2
 ,Sum((Case when Extract(Month from Cycle_Dt) in (6, 8) then 1 Else 0 End)) Tot_Cyc3
From SDW_PRDUSR_ALLVM.VISION_P2K_ACTS_V
where LINE_ACT_DT between '2002-02-01' and '2002-04-30'
and   CYCLE_DT BETWEEN '2002-04-01' and '2002-08-30'
group by 1, 2, 3 ) Derived_Table
group by 1;


     
  <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