• You dint understand the part ONLY with the count(*)/count(T1.CiD) or the entire query?

    Count(*) yielded the number of rows for CNo. But Count(T1.CiD) will yield the number of rows present in the #temp1 table pertaining to CNo. This made the difference.

    As far as the date logic goes, i will be working that up tomo, as i have some other stuff running here 🙂