My self answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
'site://a/' + CAST(a.Id AS NVARCHAR) + '/' + CAST(m.Id AS NVARCHAR) + '|' + q.Title AS atl,
q.tags AS qta,
COALESCE('site://users/' + CAST(a.OwnerUserId AS NVARCHAR) + '|' + u.DisplayName, a.OwnerDisplayName) AS uli,
a.CreationDate AS ada,
a.Id AS aid
FROM Posts AS a
JOIN Posts AS q ON a.ParentId = q.Id
LEFT JOIN users AS u ON u.Id = a.OwnerUserId
LEFT JOIN Users AS m ON m.AccountId = 1192385
WHERE 2 = a.PostTypeId AND 
(q.OwnerUserId = a.OwnerUserId OR q.OwnerDisplayName = a.OwnerDisplayName)
AND q.OwnerUserId = m.Id
ORDER BY q.Id, a.Id;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results