Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sun, 17 Oct 2004 @ 10:26:17 GMT


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


Subj:   Re: Can this query be written more efficient
 
From:   Anomy Anom

<-- Anonymously Posted: Wednesday, October 13, 2004 09:59 -->

The two tables have the same structures and same PIs. Only columns X and Y are the same, so the union does not work, as it duplicates all the mtable rows. I need any rows in table that also has a row in mtable with the same X and Y to be excluded from table and be inserted from mtable into table_copy.

     table:
     -------
           X           Y           newcol
           1           c           table
           2           c           table
           3           c           table
           4           c           table
           5           c           table
           6           c           table
           7           c           table
           8           c           table
           9           c           table


     mtable:
     -----------

           X           Y           newcol
           1           c           mtable
           2           c           mtable
           3           c           mtable


     table_copy  needs to look as follows:
     -------------------------------------

           X           Y           newcol
           1           c           mtable
           2           c           mtable
           3           c           mtable
           4           c           table
           5           c           table
           6           c           table
           7           c           table
           8           c           table
           9           c           table

Thanks...



     
  <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