• Hi Abinash, Welcome to SSC.

    Its a good start, but this is not how you post a question in an online forum. Its near impossible to understand your requirement....just by reading your explanation. We can't see your problem from here until you post some readily consumable sample data. Attaching excel files is not considered readily consumable sample data. People here are working and take some time off their busy schedules to answer these questions, so nobody would have the time to download your excel files and then provide a solution.

    Please have a look at the link in my signature. It has all the information you need to get your problem solved quickly.

    Please post DDL of the tables, readily consumable sample data as a batch of Insert statements......an then post the requirement. If you do the above mentioned things then I am sure that someone would come up with a very quick....working....and tested solution to your requirement.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉