Link to home
Start Free TrialLog in
Avatar of montrof
montrofFlag for United States of America

asked on

Update column based on Join

I am trying to update a column to Y if the certain columns join.  My current statement seems to take forever to run, so I was wondering if maybe there is a better way to write it.

UPDATE SS.MCS_EV_SALES  pd
   SET Pass1_Match = 'Y'
   WHERE EXISTS(SELECT   1
                 FROM SS.MCS_RJ rj
                WHERE rj.LWCP = pd.LWCP
                  AND rj.X_NUMBER = pd.X_NUMBER
                  AND rj.SET_NUMBER = pd.SET_NUMBER
                  AND rj.MONTH <= pd.MONTH
                  ) ; COMMIT;

Thanks,
Montrof
ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of montrof

ASKER

I am adding them now to see if that helps.
After creating them you should also gather statistics to aid the optimizer.
Avatar of montrof

ASKER

Thanks