Hi all, I have modified my query with Partition By, and it gave the correct results. Thanks once again for your reply.