‎2007 May 25 2:37 PM
Hi gurus,
Please let me know if any one have used Update query with IN operator in where clause. please give sample code. it will be really helpfull.
i want to update a table having duplicate records. I want to set the status = e if record is having duplicate entry in table.
I am writting this query.
update zrbpf_cv004
set status = 'E'
message = 'Duplicate'
where employee_id in
( select employee_id
from zrbpf_cv004
group by b~employee_id
having count( * ) > 1 ).
‎2007 May 25 9:35 PM
data : begin of itab occurs 0,
employee_id like employee_id-zrbpf_cv004,
end of itab.
ranges r_emp for zrbpf_cv004-employee_id.
select employee_id
into itab
from zrbpf_cv004
group by employee_id
having count( * ) > 1.
loop at itab.
clear r_emp.
r_emp-sign = 'I'.
r_emp-option = 'EQ'
r_emp-low = itab-employee_id.
append r_emp.
endloop.
update zrbpf_cv004
set status = 'E'
message = 'Duplicate'
where employee_id in r_emp.