All caps titles (all-caps, capitals)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- includeDoomed: Include questions that will likely be auto-deleted? (0 or 1) "Enter 1 to include doomed questions."
DECLARE @includeDoomed  int         = ##includeDoomed:int?0##;
DECLARE @cutoffDate     datetime    = dateAdd (dd, -30, GETDATE() );

WITH ansPerQst AS (
    SELECT
                p.ParentId,
                COUNT (p.Id)    AS numAnswers
    FROM        Posts p
    WHERE       p.PostTypeId    = 2
    GROUP BY    p.ParentId
)
SELECT
            p.Id as [Post Link],
            p.CreationDate,
            p.Score,
            apq.numAnswers  AS [# Answers]
FROM        Posts p
LEFT JOIN   ansPerQst apq
ON          apq.ParentId    = p.Id
WHERE       p.PostTypeId    = 1
AND         p.ClosedDate    IS NULL
AND         p.Title         = UPPER (p.Title)
AND         (
    @includeDoomed = 1
    OR  p.Score >= 0
    OR  p.CreationDate  < @cutoffDate
    OR  apq.numAnswers  > 0
)
ORDER BY    p.Score DESC,
            p.CreationDate DESC

Enter Parameters

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