The below query is updating all the rows in the table1 eventhough the inner query only selects few of the rows. Any help. Appreciate it. Thanks,
UPDATE table1 out
SET (col1, col2, col3) =
(SELECT col1, col2, col3 FROM
(SELECT col1, col2, col3
FROM table1 in,
table2 a,
table3 b
WHERE a.subid = in.subid
AND in.id BETWEEN min AND max
AND b.custid = a.custid
AND b.exp_date IS NULL
AND a.amount <> rc) lts
WHERE lts.id = out.id
AND lts.rc IS NOT NULL)