Business case:
Table1 did not get updated by someone elses data load, so I have to fix it. (Yay!)
Anyway, here is the case.
Table1.hrc needs updated to match Table2.hrc with the following conditions:
Table1.num = Table2.num
and Table2.status = 'HOLD'
and Table1.hrc is null
and Table2.hrc is not null
I know this should be easy, but I can't get it to return a single row(always multiple). The following query returns the records I need to update, I just can't get the update to run as this selects multiple records.
select Table2.num, Table1.num, Table2.hrc, Table1.hrc, Table2.status
from Table2 w, Table1 s
where Table2.hrc is not null
and Table1.hrc is null
and Table2.status = 'HOLD'
and Table2.num = Table1.num
and Table2.siteid = Table1.siteid
group by Table2.num, Table1.num, Table2.hrc, Table1.hrc, Table2.status;
Thanks in advance.
Table1 did not get updated by someone elses data load, so I have to fix it. (Yay!)
Anyway, here is the case.
Table1.hrc needs updated to match Table2.hrc with the following conditions:
Table1.num = Table2.num
and Table2.status = 'HOLD'
and Table1.hrc is null
and Table2.hrc is not null
I know this should be easy, but I can't get it to return a single row(always multiple). The following query returns the records I need to update, I just can't get the update to run as this selects multiple records.
select Table2.num, Table1.num, Table2.hrc, Table1.hrc, Table2.status
from Table2 w, Table1 s
where Table2.hrc is not null
and Table1.hrc is null
and Table2.status = 'HOLD'
and Table2.num = Table1.num
and Table2.siteid = Table1.siteid
group by Table2.num, Table1.num, Table2.hrc, Table1.hrc, Table2.status;
Thanks in advance.