;With NumberTable(N)
AS
(
SELECT 1
UNION ALL
SELECT N + 1
FROM NumberTable
WHERE N + 1 <= 10
)
SELECT n.N,COALESCE(t.[count],0) AS [count]
FROM NUmberTable n
LEFT JOIN YourTable t
ON t.id = n.N
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/