The following query is updating all the (80k) records instead of the ones that match (5k). What is wrong with it and how can it be corrected?
update ALAM set ALAM.CDate = (select IDCP.CDate from IDCP
where ALAM.ASID = IDCP.ASID and ALAM.AID = IDCP.AID
and ALAM.MCode = '10001')
Record Count of ALAM Table = 80,000 records approx Record Count of IDCP Table = 5,000 records approx
As additional information:
select ALAM.ASID, ALAM.AID, ALAM.CDate
from ALAM, IDCP
where ALAM.ASID = IDCP.ASID and ALAM.AID = IDCP.AID and ALAM.MCode = '10001'
result 5000 records approx