Avatar of montrof
montrof
Flag 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
Oracle Database

Avatar of undefined
Last Comment
montrof

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
awking00

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
montrof

ASKER
I am adding them now to see if that helps.
awking00

After creating them you should also gather statistics to aid the optimizer.
montrof

ASKER
Thanks
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23