SELECT
p.Id,
v.c
FROM dbo.Posts AS p
CROSS APPLY
(
SELECT
c = COUNT_BIG(*)
FROM dbo.Votes AS v
WHERE v.PostId >= p.Id
AND v.PostId <= p.Id
) AS v
WHERE p.Id IN
(
11227806, 11227810, 11227820, 11227824,
11227826, 11227827, 11227831, 11227833,
1368149, 17463071, 11227809
)
ORDER BY
p.Id
OPTION
(
RECOMPILE,
QUERYTRACEON 8649
);