find similar tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

SET NOCOUNT ON
CREATE TABLE #Posts (
  Id bigint
  , Body nvarchar(max)
  , OwnerUserId bigint
  , Hash nvarchar(32)
)
CREATE INDEX IX_Posts_Id ON #Posts (Id)
CREATE INDEX IX_Posts_OwnerUserId ON #Posts (OwnerUserId)
CREATE INDEX IX_Posts_Hash ON #Posts (Hash)

INSERT INTO #Posts
SELECT TOP 1000 Id, Body, OwnerUserID, Hash=CONVERT(VARCHAR(32), HashBytes('MD5', Body), 2)
FROM Posts
WHERE PostTypeId=2
ORDER BY ID DESC


SELECT Hash, c=COUNT(*)
INTO #Results
FROM #Posts
GROUP BY Hash
HAVING COUNT(*)>1

SELECT T1.Id, T2.Hash, T2.C
INTO #AllIds
FROM #Posts T1
INNER JOIN #Results T2
ON T1.Hash=T2.Hash

select * from #Results
select * from #Posts
select * from #AllIds

Enter Parameters

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