Longest questions

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
(SELECT TOP 1
    LEN(e.Text) 
    FROM PostHistory AS e 
    WHERE q.Id = e.PostId AND e.PostHistoryTypeId IN (2,5,8)
    ORDER BY e.id DESC) 
    AS qle,
LEN(q.Body) AS qlh,
'site://q/' + CAST(q.Id AS NVARCHAR) + '/' + CAST(m.Id AS NVARCHAR) + '|' + q.Title AS qtl,
q.tags AS qta,
COALESCE('site://users/' + CAST(q.OwnerUserId AS NVARCHAR) + '|' + u.DisplayName, q.OwnerDisplayName) AS uli,
q.CreationDate AS qda,
q.Id AS qid
FROM Posts AS q
LEFT JOIN users AS u ON u.Id = q.OwnerUserId
LEFT JOIN Users AS m ON m.AccountId = 1192385
WHERE 1 = q.PostTypeId
AND 8000 <= LEN(q.Body)
ORDER BY qle DESC;

Enter Parameters

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