Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 05 Nov 2010 @ 17:12:00 GMT


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


Subj:   Re: Compare data in same column
 
From:   Good, Ken

     select TT.member_id,
     Case when TwoIn.member_id is null Then 'No' Else 'Yes' End As Two_In_Twelve_Months from
     TheTable TT left outer join (select a.member_id from TheTable a, TheTable b where
     a.member_id = b.member_id and a.date_admitted <> b.date_admitted and (a.date_admitted
     between b.date_admitted and b.date_admitted + 365 or b.date_admitted between
     a.date_admitted and a.date_admitted + 365) group by 1) TwoIn on TT.member_id =
     TwoIn.member_id group by 1,2;

Kenneth M. Good, BCIS, MIT
State of Michigan/DTMB/Infrastructure Services Data Center Services/Enterprise Platform
Services Data Warehouse Support



     
  <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