SELECT d.Name,t.N*10 AS DeciCount FROM (SELECT Name,COUNT(*) AS TheCount FROM #Name GROUP BY Name) d INNER JOIN dbo.Tally t ON t.N <= d.TheCount