• NEI (Not Enough Information). Still don't know what you are trying to accomplish, plus the code I see just looks wrong from the get go. Plus, you have variables in your posted code that I don't see any declaration for.

    Again, what are you try to accomplish? A good explaination, table DDL, sample data, and expected results would really help you get the help you need to meet your objectives.

    😎