Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update query

Former Member
0 Likes
263

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 ).

1 REPLY 1
Read only

Former Member
0 Likes
229

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.