vishnurajeshsat (5/23/2013)
Thank you it works:-)
Glad it works for you and I hope you understand what it does 🙂
In case you don't, make sure you understand it by looking up CTE and DENSE_RANK() on Google or Books Online
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/