• Thanks for all the help. As I said using temp table did resolve the issue