/*Looks for possible duplicate accounts by searching for ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla

Q&A for Joomla! administrators, users, developers and designers

/*Looks for possible duplicate accounts by
searching for accounts with the same name
created in short succession.*/

DECLARE @PostCount AS INT
DECLARE @IdDiff AS INT
SET @PostCount = 5
SET @IdDiff = 10

SELECT
    u1.Id AS [User Link],
    COUNT(p1.Id) AS 'Number of posts',
    u1.Reputation
FROM
    Users u1
INNER JOIN
    Users u2 ON u1.DisplayName = u2.DisplayName
	AND u1.Id != u2.Id
INNER JOIN
    Posts p1 ON p1.OwnerUserId = u1.Id
INNER JOIN
    Posts p2 ON p2.OwnerUserId = u2.Id
WHERE
    ABS(u1.Id - u2.Id) <= @IdDiff
GROUP BY
    u1.Id,
	u1.DisplayName,
    u1.Reputation
HAVING
    COUNT(p1.Id) >= @PostCount
ORDER BY
    u1.Reputation

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results