I am trying to pivot three row into three columns. The SQL is listed below that returns the rows.
SELECT TOP (3) DD.Name
FROM cs10.DTreeAncestors AS a INNER JOIN
cs10.DTree AS DD ON a.AncestorID = DD.DataID
WHERE (a.AncestorID <> a.DataID) AND (a.DataID = 169427) AND
(a.AncestorID <>
(SELECT ParentID
FROM cs10.DTree
WHERE (DataID = a.DataID)))
ORDER BY a.AncestorID DESC