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)

Earth Science Meta

Q&A about the site for those interested in the geology, meteorology, oceanography, and environmental sciences

-- 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