Hello,
I have a query that updates certain fields based on a select query. The problem is that the update seems to be working on every single row in the database regardless of the select statement. It does not appear that the select statement is being executed.
A second update query follows this code but the structure is the same. If I can get this working, I will modify the associated query.
Could anyone help me to determine why my query is not working on a few rows and instead it changes every single row. Any help is greatly appreciated.
Thanks.
If at first you don't succeed, then sky diving wasn't meant for you!
I have a query that updates certain fields based on a select query. The problem is that the update seems to be working on every single row in the database regardless of the select statement. It does not appear that the select statement is being executed.
Code:
UPDATE OEORDD
SET
QTYORDERED = 0,
QTYBACKORD = 0,
TBASE1 = 0,
TBASE2 = 0,
TBASE3 = 0,
TBASE4 = 0,
TBASE5 = 0,
TAMOUNT1 = 0,
TAMOUNT2 = 0,
TAMOUNT3 = 0,
TAMOUNT4 = 0,
TAMOUNT5 = 0,
TRATE1 = 0,
TRATE2 = 0,
TRATE3 = 0,
TRATE4 = 0,
TRATE5 = 0,
COMPLETE = 2
WHERE EXISTS
(SELECT OEORDD.*
FROM OEORDH INNER JOIN
OEORDD ON OEORDH.ORDUNIQ = OEORDD.ORDUNIQ
WHERE OEORDH.COMPLETE < 3 AND OEORDD.QTYBACKORD > 0 AND OEORDD.QTYSHPTODT > 0)
A second update query follows this code but the structure is the same. If I can get this working, I will modify the associated query.
Could anyone help me to determine why my query is not working on a few rows and instead it changes every single row. Any help is greatly appreciated.
Thanks.
If at first you don't succeed, then sky diving wasn't meant for you!