Quote:
|
In the above query I am using one more condition that A.ACTION_IDEN <> 'CNL', but it is updating that row also.
|
I couldn't understand well
your requirements and issue.
If you include the condition(A.ACTION_IDEN <> 'CNL'),
SQL wouldn't update the rows having corresponding row(s) with A.ACTION_IDEN = 'CNL'.
One possibility I could guess was there were multiple corresponding rows in A
but some were A.ACTION_IDEN = 'CNL' and others were A.ACTION_IDEN <> 'CNL'.
Quote:
|
And the column ACTION_IDEN is not present in the second table.
|
No problem.
If you want to exclude the rows which have corresponding row(s) in A but all A.ACTION_IDEN = 'CNL',
simply add the condition, like...
Code:
UPDATE mbid.TSCHCLD F
SET F.DEI_2 = 'AA'
WHERE EXISTS
(SELECT 0
FROM mbid.TSCH A
WHERE F.FLIGHT_NUMBER = A.FLIGHT_NUMBER
AND F.FIRST_LEG_DEP_DATE = A.FIRST_LEG_DEP_DATE
AND F.FLIGHT_DESIGNATOR = A.FLIGHT_DESIGNATOR
AND F.FLIGHT_OP_SUFFIX = A.FLIGHT_OP_SUFFIX
AND A.ACTION_IDEN <> 'CNL'
)
AND F.FLIGHT_NUMBER = 24
AND F.FLIGHT_DESIGNATOR = 'DD'
;