How close are you to a Taxonomist Badge

6

Please login or register to vote for this query.

(click on this box to dismiss)

Recommended value for MinCountOfQuestionsPerBadge is 25, otherwise the query will run for too long. This means we will only look at tags which have >25 questions or more in them.

Christianity

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

SELECT id, tagname, count, -999 AS 'creatorid'  -- Can't use -1 as that's community
INTO   #t1 
FROM   tags 
WHERE  count <= 50
GO
-- DisplayName
DECLARE @userid int
SELECT  @userid=##UserId##
DECLARE @id int
DECLARE @creatorid int
DECLARE @tagname nvarchar (25)

WHILE (EXISTS (SELECT 1 FROM #t1 WHERE creatorid = 999))
begin
    SELECT @id=min(id) 
    FROM   #t1 
    WHERE  creatorid = -999
    
    SELECT @tagname=tagname 
    FROM   #t1 
    WHERE  id=@id

    SELECT @creatorid = userid
    FROM   PostHistory PH1
    WHERE  text like '%<'+@tagname+'>%'
     AND   PostHistoryTypeId IN (3,6,9)
     AND   NOT EXISTS (SELECT 1 
                       FROM   PostHistory PH2
                       WHERE  PH2.text like '%<'+@tagname+'>%'
                        AND   PH2.PostHistoryTypeId in (3,6,9)
                        AND   PH1.CreationDate > PH2.CreationDate)

    SELECT @creatorid = COALESCE(@creatorid, -1000) -- in case it's null, so we don't get infinite loop
    UPDATE #t1 
    SET    creatorid = @creatorid
    WHERE  id=@id
    
end
go
SELECT *
FROM   #t1
WHERE  creatorid = ##UserId##
DROP TABLE #t1
go

Enter Parameters

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