SELECT ph.Id AS HistoryId, ph.PostId, ph.RevisionGUID, p....

0

Please login or register to vote for this query.

(click on this box to dismiss)

Data Science Meta

Q&A about the site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field

-- This SQL query fetches the content of Stack Overflow answer posts based on specific IDs from the PostHistory table
SELECT
    ph.Id AS HistoryId,
    ph.PostId,
    ph.RevisionGUID,
    p.Body AS PostContent,
    ph.CreationDate,
    ph.UserId,
    u.DisplayName AS UserName
FROM
    PostHistory ph
JOIN
    Posts p ON ph.PostId = p.Id
LEFT JOIN
    Users u ON ph.UserId = u.Id
WHERE
    ph.PostHistoryTypeId = 5  -- Edit Body
    AND p.PostTypeId = 2      -- Answer Posts
    AND ph.Id IN (12345, 67890, 101112)  -- Replace these IDs with your specific History IDs
ORDER BY
    ph.CreationDate;

Enter Parameters

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