Anton.Sandbox

1

Please login or register to vote for this query.

(click on this box to dismiss)

Language Learning

Q&A for students, teachers, polyglots, and anyone interested in the techniques of second-language acquisition

-- The best time to ask questions
-- Look for the minimum value on y-scale:
-- It says when the time between question and answer is minimal.
-- For example

DECLARE @Frequency int = ##Frequency:int?3##

;WITH tmp AS
(
  SELECT DATEDIFF(minute, q.CreationDate, a.CreationDate) as diffMin,
  DATEPART("weekday", q.CreationDate) as wd,
         ROUND((CAST(DATEPART("weekday", q.CreationDate) AS numeric) +
                CAST(DATEPART("hour", q.CreationDate) AS numeric) / 24), 2) as cat
  FROM Posts q
    LEFT OUTER JOIN Posts a ON q.AcceptedAnswerId = a.Id
  WHERE q.AcceptedAnswerId > 0
  )
  SELECT CASE @Frequency WHEN 1 THEN wd ELSE cat END, AVG(diffMin)
FROM tmp
GROUP BY CASE @Frequency WHEN 1 THEN wd ELSE cat END
ORDER BY CASE @Frequency WHEN 1 THEN wd ELSE cat END

Enter Parameters

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