0

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)

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by hfx642
0

Okay...
1. Your Update statement has NO Where clause.
2. You have a Select statement within a Select statement that is NOT needed. ie. Simplify it!

Edited by hfx642: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.