Hi All,
I wrote this following UPDATE JOIN query. It works well when I have a small amount of data in both tables. But it takes a while when I have more data. Is there any way that I can improve this? Thank you in advance!
Update ALLPOL set POLH_AGENTTOTAL_PRIOR_Q = (select sum(CSFD_QUARTER_DATA) from ALLCSFD where ALLCSFD.CSFDPOL in (select POLH_POLICY_SEQUENCE from ALLPOL as P where P.POLH_AGENT_ID=ALLPOL.POLH_AGENT_ID AND P.POLH_AGENT_HOUSEHOLD_INDICATOR=ALLPOL.POLH_AGENT_HOUSEHOLD_INDICATOR) and ALLCSFD.CSFD_ROW_LABEL='Beginning Value')
I wrote this following UPDATE JOIN query. It works well when I have a small amount of data in both tables. But it takes a while when I have more data. Is there any way that I can improve this? Thank you in advance!
Update ALLPOL set POLH_AGENTTOTAL_PRIOR_Q = (select sum(CSFD_QUARTER_DATA) from ALLCSFD where ALLCSFD.CSFDPOL in (select POLH_POLICY_SEQUENCE from ALLPOL as P where P.POLH_AGENT_ID=ALLPOL.POLH_AGENT_ID AND P.POLH_AGENT_HOUSEHOLD_INDICATOR=ALLPOL.POLH_AGENT_HOUSEHOLD_INDICATOR) and ALLCSFD.CSFD_ROW_LABEL='Beginning Value')