Hello,
I have an update query that seems to be updating the records in reverse.
I am trying to update a column that has a value of '0' or a NULL.
I need to update these rows with a default value from a lookup table.
So when I run the below query, it just does the opposite! Even with all the joins,
to ensure a specific record does get updated.
I created a temporary table that holds all of the rows that have a - ard_risk_likelyhood
of '0' or NULL.
On the assessment_response_details table, there are like 168k records.
On the temp table, there are like 7k records or rows with a '0' or NULL.
So of the 168k records, there is a value other than '0' or NULL, so these records are good and should not be updated, only those 7k records in question.
When I run the update below, it is updating the 168k records to NULL or the
ard_risk_likelyhood column to null!
What do I need to change, to ensure only the 7k records get updated.
Thanks,
Update Assessment_Response_Details ard
Set ard.Ard_Risk_Likelyhood =
(Select Distinct ta.vafmd_Likelyhood
From tmp_assessments ta
Where ta.ard_id = ard.ard_id
And ta.ard_aqb_id = ard.ard_aqb_id
And ta.ard_arh_id = ard.ard_arh_id
And ard.Ard_Risk_Likelyhood In (0, null));
Using - Windows OS and Oracle 11g