Thanks for your reply,
I did the same, but the performance of the query is not really good, it taking such a long time to get the result, and every row the query touches twice.
is it possible to get same thing with better result using CTE / derived queries ?
thanks & regards
Saravanakumar.R