Thanks for the prompt response. Yes your assumptions are correct.
Can you clarify this statement. I think it contains some special characters
SELECT COUNT(*) + 1 FROM #temp1 WHERE DataDifference > 1
What is "> 1" ?
How do you mean "assign a group" ?
Thanks.