sample random comments

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @totalComments bigint;
select @totalComments = count(id) from comments;

select
u.displayname,p.id,c.id,c.text
from users u
join posts p
on p.owneruserid = u.id
join comments c
on c.postid = p.id
and hashbytes('md5', c.text) % (@totalComments / ##desiredSampleSize?50000##) = ##samplingSeed?0##

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results