Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 28 May 2003 @ 16:17:15 GMT


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


Subj:   Re: Delete from a union
 
From:   Claybourne Barrineau

I think this should work.

Hope it helps,

Clay


     Delete from Customer
     Where (sequence_number, name, address, age, type)
     in
     (
     Select  sequence_number,
             name,
             address,
             age,
             type
     from    customer customer1,
             customer customer2
     where   customer1.name = customer2.name
     and     customer1.address = customer2.address
     and     customer1.age = customer2.age
     and     customer1.type = 'a'
     and     customer1.sequence_number = customer2.sequence_number - 1
     union
     Select  sequence_number,
             name,
             address,
             age,
             type
     from    customer customer1,
             customer customer2
     where   customer1.name = customer2.name
     and     customer1.address = customer2.address
     and     customer1.age = customer2.age
     and     customer2.type = 'b'
     and     customer1.sequence_number + 1 = customer2.sequence_number
     );


     
  <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