I've been working on a query to count the number of days a user's posts have had votes up, with no votes down on any day. But it seems like it's missing some posts. Users that have Four Ayes, do not seem to show up in this report.
Can someone tell me where I'm going wrong with this query?
WITH FourAyes (Id, DisplayName, Title, Up, Down, Created)
AS
(
SELECT p.Id, u.DisplayName, p.Title,
SUM(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE 0 END),
SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END),
CONVERT(DATE, p.CreationDate)
FROM Posts p
JOIN Users u on u.Id = OwnerUserId
JOIN Votes v on p.Id = v.PostId and v.VoteTypeId between 2 and 3
WHERE u.DisplayName = '##Name##'
AND p.CreationDate > '2022-12-14 21:00'
GROUP BY p.id, u.DisplayName, p.Title, p.CreationDate
)
SELECT Id as [Post Link], DisplayName, Title, Up, Created
FROM FourAyes
WHERE Down = 0
ORDER BY Id