Re: Beginner...update stmt.
Posted in 2000
UPDATE compare_forecast SET compare_forecast.New_A12 = (SELECT Step1.sumofregunits * upc_rslts_fcst.New_R_PCT FROM upc_rslts_fcst, Step1 WHERE Step1.upc = compare_forecast.upc AND Step1.upc = upc_rslts_fcst.upc AND Step1.week = compare_forecast.week AND Step1.week = upc_rslts_fcst. week AND compare_forecast.district = upc_rslts_fcst.district AND compare_forecast.location = Step1.location ); Thats a little better to look at... What kind of indexes do you have on these tables ? Try adding these indexes: Step1 upc,week Compare_forecast upc,week,district,location upc-rslts_fcst upc,week Post a query plan for this query. It might shed some light on why it is so slow.