Forum Discussion
Merging column
Hi Nagababu ,
To achieve the expected output, we need to merge theatro_employee_id values based on specific conditions. The merging should occur when multiple theatro_employee_ids share the same customer_employee_id, but only if their first_name and last_name match exactly. Otherwise, unique records should retain their own theatro_employee_id as the MergeFlag.
The first step is to identify groups of records with the same customer_employee_id. Within each group, if multiple records have the same first_name and last_name, they should be assigned the same MergeFlag, which is the minimum theatro_employee_id within that group. If a record has a unique first_name and last_name, its own theatro_employee_id should be used as its MergeFlag.
For example, in the provided data:
- customer_employee_id = 1 has multiple entries for "John Doe" (101, 102, 107, 108), so all of them receive MergeFlag = 101 (the lowest theatro_employee_id in the group).
- "Spin George" does not have duplicates, so it retains 103 as its MergeFlag.
- "Jane Doe" has only one entry, so it gets MergeFlag = 104.
- "Mary Doe" is unique, so it gets MergeFlag = 105.
- "John Smith" is unique, so it gets MergeFlag = 106.
- For customer_employee_id = 2 and 3, each entry is unique and retains its theatro_employee_id.
- Nagababu1 year agoNew Member
Thanks for responding rohit1991