Company Process Control - Duplicated Check Input Results
🤔 Problem
Run job in CPC but getting warning: There are duplicate Check Input Results for the same Check Input Items. This issue occurs when the same Check Input was translated more than one time.
🌱 Solution
Gather the following information:
Accounting Date
Production Date
Use below query to identify what Checks have duplicate result lines:
SQL
with find_duplicate_results as (
select row_number() over (partition by check_number, accounting_date, production_date, check_input_item_id, line_number order by batch_run_id asc) as rowz,
*
from check_input_results where accounting_date = '2025-03-10'
)
select * from find_duplicate_results
where rowz > 1
Modify query to delete the duplicates:
SQL
with find_duplicate_results as (
select row_number() over (partition by check_number, accounting_date, production_date, check_input_item_id, line_number order by batch_run_id asc) as rowz,
id
from check_input_results where accounting_date = '2025-03-10'
)
delete from find_duplicate_results
where rowz > 1