• Bruce,

    writing the same code I wrote using MERGE statement is not very easy , I am not sure if it is possible, and I wanted to provide code that anybody can reuse, changing table and column names.

    Using cross join instead of inner join .. on 1=1 of course is less confusing .