I have a form that displays a list of systems along with their current status. The user can change the status and the date of that status change is stored in a history table. The user can also change the name of the server as a status changes (for example, if a system is replaced due to a lease roll).
The history table stores the details by systemname
so if the system name changes on the form, the history also needs to be updated (along with all the historical changes). On the form, there is a hidden field named originalsystemName
so we know if the systemname
matches or not when the form is saved.
<input type='text' name='systemname'>
<input type='text' name='originalSystemName'>
<input type='text' name='status'><input type='submit' type='submit'>
I came up with the following query but I'm getting an error (see below the query).
update SysHistory set
SystemName = (
select distinct t.systemname
from systemInfo_tmp t, SysHistory h
where t.systemname != t.originalSystemName
)
where systemname in (
select distinct t1.originalSystemName
from systemInfo_tmp t1, SysHistory h1
where t1.systemname != t1.originalSystemName
)
Error I'm receiving:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.