Itertools Count Function Sql Server