Four Ayes

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

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

Enter Parameters

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