Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 18 Oct 2007 @ 12:27:24 GMT


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


Subj:   Re: Conditionally Converting a Many to One relationship
 
From:   Michael Larkins

Hi Mat:

This is really quite an easy task when you use a case with a derived table:

     select item
             ,case when mn=1 and mx=1 then 5
                   when mn=2 and mx=3 then 4
                                      else 6
     from (select item_id item, min(item_attribute) mn, max(item_attribute) mx
            from item_table
            group by item_id) min_max

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