I have a table like
ID Identifier source value opendate closedate activeFlag
--------------------------------------------------------
101 euid01 File01 x010 01-01-2023 01-01-2999 1
101 euid02 File01 x111 01-01-2023 01-01-2999 1
101 euid02 File01 x222 01-01-2023 01-10-2024 0
102 euid01 File11 x010 01-01-2023 01-01-2999 1
102 euid02 File12 x333 01-01-2023 01-01-2999 1
102 euid02 File10 x444 01-01-2023 01-10-2024 0
I want to pass a values like (102,101) to merge 102 into 101 to a function or procedure to get the output as below, basically it should merge 102 into 101 and once merged delete 102
If the identifier and values are same for two different IDs ignore that rec during merge, closedate can be get sysdate or getdate in case of terming them out.
All the records in 102 will be termed out except which has Identifier and value same, in this case we ignore that record.
ID Identifier source value opendate closedate activeFlag
-----------------------------------------------------------
101 euid01 File01 x010 01-01-2023 01-01-2999 1
101 euid02 File01 x111 01-01-2023 01-01-2999 1
101 euid02 File01 x222 01-01-2023 01-10-2024 0
101 euid02 File12 x333 01-01-2023 22-10-2024 0
101 euid02 File10 x444 01-01-2023 22-10-2024 0