Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sun, 20 Apr 2008 @ 09:31:53 GMT


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


Subj:   Re: Cross join in update statement
 
From:   McCall, Glenn David

Are you sure you want to do a cross join in an update?

A cross join means that every row in one table (catelog_item) is matched to every other row in another table (forecastplan). This means that every row in catalog_item could potentially have multiple different values applied to it. I suspect this won't work well for you.

I see you are trying to apply a qualification based upon a "PK" value? If so, I think you are trying to do an inner join (not a cross or product join). You might be better of with something like this:

     UPDATE CATALOG_ITEM
         SET CURRENT_PERIOD_ID = FORECAST_PLAN.IMPORT_PERIOD_ID,
             CURRENT_EFFECTIVE_PERIOD_ID = FORECAST_PLAN.IMPORT_PERIOD_ID
         WHERE CATALOG_ITEM.NATIVE_PK = FORECAST_PLAN.inSKU_ID;

You might want to double check that there is a 1:1 or m:1 relationship between catalog_item and forecast_plan otherwise you might get some unexpected results.


Hope this helps

Glenn Mc



     
  <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: 27 Dec 2016