How many answers did I submit on different days?


Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

DECLARE @TagId int = (
FROM Tags t
WHERE t.TagName = ##TagName:string##

--DECLARE @OtherTagId int = (
--  t.Id
--FROM Tags t
--WHERE t.TagName = ##OtherTagName:string##

DECLARE @UserId int = ##UserId## 
-- DECLARE @date  = ##FromDate:string## 

-- Id of the post
-- Post URL
  CONCAT('', p.Id, '/', p.Title) AS [Post],
-- Post Creation Date
-- Tags associated with post
-- Score associated with post
-- Number of answers provided
-- Number of comments provided
-- User name of Answer provider
  u.DisplayName as AnsweredBy,
-- Commented by Developer Support or not
  CASE WHEN ISNULL(c.UserId,0) = 0 THEN 'No Comment' ELSE 'Commented' END AS Comment,
-- Comment Date
  c.CreationDate as CommentDate,
-- Answered or not
  CASE WHEN ISNULL(a.Id,0) = 0 THEN 'No Answer' WHEN ISNULL(a.OwnerUserId,0) = @UserId THEN  'Answered' ELSE 'Answered via Community' END AS Answer,
-- Answer Date
  a.CreationDate as AnswerDate,
-- Accepted Answer or not
  CASE WHEN ISNULL(p.AcceptedAnswerId,0)!= 0 AND p.AcceptedAnswerId = ISNULL(a.Id,0)  THEN 'Accepted Answer' ELSE '' END AS Acceptance

  FROM PostTags ptg
--JOIN PostTags otherTags ON otherTags.PostId = ptg.PostId
JOIN Posts p ON p.Id = ptg.PostId
LEFT JOIN Posts a ON a.ParentId = p.Id 
--LEFT JOIN Users u ON (u.Id = a.OwnerUserId OR u.Id = c.UserId)
LEFT JOIN Users u ON u.Id = a.OwnerUserId

-- AND (a.OwnerUserId = @UserId OR a.OwnerUserId>0)
LEFT JOIN Comments c ON c.PostId = p.Id AND c.UserId = @UserId
WHERE ptg.TagId = @TagId 
-- Post after date '2021-01-01'
AND p.CreationDate > COALESCE(TRY_CONVERT(date, '2022-04-01', 111), '2022-04-01')
AND p.CreationDate < COALESCE(TRY_CONVERT(date, '2022-04-30', 111), '2022-04-30')
-- DATEADD(day,-190,GETDATE()) 
--AND otherTags.TagId = @OtherTagId
-- GROUP BY p.Id

ORDER BY p.CreationDate DESC

-- TagName: Exact Name of Tag#1: e.g. here-api
-- FromDate: Enter From Date : 
-- UserId : Enter the User ID : e.g. 3505695

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results