This query returns the number of edits you still need to
get the Copy Editor badge.
Q&A about the site for builders and users of networked sensors and control devices in the contexts of smart homes, industry automation, or environmental sensors
-- Copy Editor Progress
-- This query returns the number of edits you still need to
-- get the Copy Editor badge.
DECLARE @userid int = ##UserId##
SELECT 500 - COUNT(*) AS EditsLeft
FROM PostHistory ph
WHERE PostHistoryTypeId IN (4,5)
AND PostId NOT IN (
FROM Posts p
WHERE p.OwnerUserId = ph.UserId
AND UserID = @userid
GROUP BY PostID
) AS bar