Anton.Sandbox

1

Please login or register to vote for this query.

(click on this box to dismiss)

Salesforce

Q&A for Salesforce administrators, implementation experts, developers and anybody in-between

-- 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

SELECT TOP 5 DATEDIFF(minute, q.CreationDate, a.CreationDate) as diffMin,
         ROUND((CAST(DATEPART("weekday", q.CreationDate) AS float) +
                CAST(DATEPART("hour", q.CreationDate) AS float) / 24), 2) as cat
  FROM Posts q
    LEFT OUTER JOIN Posts a ON q.AcceptedAnswerId = a.Id
  WHERE q.AcceptedAnswerId > 0
/*
WITH tmp AS
(
  SELECT *, DATEDIFF(minute, q.CreationDate, a.CreationDate) as diffMin,
         ROUND((CAST(DATEPART("weekday", q.CreationDate) AS float) +
                CAST(DATEPART("hour", q.CreationDate) AS float) / 24), 2) as cat
  FROM Posts q
    LEFT OUTER JOIN Posts a ON q.AcceptedAnswerId = a.Id
  WHERE q.AcceptedAnswerId > 0
  )
  SELECT cat, AVG(diffMin)
FROM Posts
GROUP BY cat
*/

Enter Parameters

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