• For those of you who have not understood my question. In one line , I have to do a data migration and have to find the child who have multiple parents. So wherever you have multiple parents then assign a new id to the child.

    eg;

    childid childname parentid

    100 abc 200

    100 abc 300

    desired output

    childid childname parentid

    100 abc 200

    101 abc 300

    I hope now this will be clear. And I am doing this for historical data so query ll be quite complicated.