DECLARE @SecondsThreshold AS Int = ##SecondsThreshold:int...

0

Please login or register to vote for this query.

(click on this box to dismiss)

LEGO® Answers

Q&A for LEGO® and building block enthusiasts

DECLARE @SecondsThreshold AS Int = ##SecondsThreshold:int?190##;
 -- 180+10 based on answering rate-limit: https://meta.stackexchange.com/a/164900/997587
WITH Pool AS (
  SELECT Id, CreationDate, Body, OwnerUserId
  FROM Posts
  WHERE
    PostTypeId = 2 -- answer
    AND Id >= 74621540
    AND LEN(Body) >= 700
),
TimeDiff AS (
  SELECT
    A.Id,
    DATEDIFF(
      second,
      LAG(A.CreationDate, 1, DATEFROMPARTS(2022,11,29)) OVER (
        PARTITION BY A.OwnerUserId
        ORDER BY A.CreationDate ASC
      ),
      A.CreationDate
    ) AS Seconds,
    Body,
    A.OwnerUserId
  FROM Pool A
)
SELECT
  A.Id AS [Post Link],
  A.Seconds,
  A.OwnerUserId AS [User Link],
  U.Reputation AS UserRep,
  U.CreationDate AS UserBday,
  PATINDEX('% help%', A.Body) AS HelpIdx,
  A.Body
FROM TimeDiff A
JOIN Users U ON U.Id = A.OwnerUserId
WHERE
  A.Seconds < @SecondsThreshold
;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results