Deleted Answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Project Management

Q&A for project managers

-- Retrieve deleted answers with comments indicating they are ChatGPT generated, along with the parent question's title and body
SELECT 
    p.Id AS [PostId],
    p.PostTypeId AS [PostType],
    p.Body AS [Body],
    p.Title AS [Title],
    ph.PostId AS [DeletedPostId],
    ph.CreationDate AS [DeletionDate],
    ph.Text AS [DeletedPostContent],
    ph.Comment AS [ModeratorComment],
    c.Id AS [CommentId],
    c.Text AS [CommentText],
    c.CreationDate AS [CommentCreationDate],
    u.DisplayName AS [Commenter],
    q.Id AS [QuestionId],
    q.Title AS [QuestionTitle],
    q.Body AS [QuestionBody]
FROM 
    PostHistory ph
LEFT JOIN 
    Posts p ON ph.PostId = p.Id
LEFT JOIN 
    Comments c ON ph.PostId = c.PostId
LEFT JOIN 
    Users u ON c.UserId = u.Id
LEFT JOIN 
    Posts q ON p.ParentId = q.Id
WHERE 
    ph.PostHistoryTypeId = 12 -- Deletion event
    AND ph.PostId IN (
        SELECT p.Id 
        FROM Posts p
        WHERE p.PostTypeId = 2 -- Only answers
    )
    AND (c.Text LIKE '%GPT%' OR ph.Text LIKE '%GPT%') -- Filter for ChatGPT mention
ORDER BY 
    ph.CreationDate DESC;

Enter Parameters

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