I'm having difficulty writing an UPDATE statement as I keep getting the error message "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
I can see the problem but I'm stuck on how I can resolve it and write the correct syntax. The subquery will return more than one row but I want the statement to update for each row populated. Can anybody help me write this query ?
update table1.incident
set table1.incident.map_reference =
(select table1.tmp_maprefchecking.mapref
from table1.tmp_maprefchecking, table1.tmp_errorlog, table1.incident
where table1.incident.incident_number = table1.tmp_maprefchecking.incid
and table1.tmp_maprefchecking.incid = table1.tmp_errorlog.cmcincidentnumber
and table1.tmp_errorlog.errorNumber = 6012
and table1.tmp_errorlog.failuredescription LIKE 'Error validating%'),
table1.incident.processed = 0
I can see the problem but I'm stuck on how I can resolve it and write the correct syntax. The subquery will return more than one row but I want the statement to update for each row populated. Can anybody help me write this query ?
update table1.incident
set table1.incident.map_reference =
(select table1.tmp_maprefchecking.mapref
from table1.tmp_maprefchecking, table1.tmp_errorlog, table1.incident
where table1.incident.incident_number = table1.tmp_maprefchecking.incid
and table1.tmp_maprefchecking.incid = table1.tmp_errorlog.cmcincidentnumber
and table1.tmp_errorlog.errorNumber = 6012
and table1.tmp_errorlog.failuredescription LIKE 'Error validating%'),
table1.incident.processed = 0