WITH TempTable AS ( SELECT OwnerUserId, COUNT(CASE WHEN C...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Cardano Meta

Q&A for users and developers of the Cardano cryptocurrency ecosystem

WITH TempTable AS (
    SELECT 
        OwnerUserId,
        COUNT(CASE WHEN CreationDate BETWEEN '2021-09-05' AND '2021-11-28' THEN Id ELSE NULL END) AS CountPeriodA,
        COUNT(CASE WHEN CreationDate BETWEEN '2021-12-05' AND '2022-02-27' THEN Id ELSE NULL END) AS CountPeriodB
    FROM posts
    WHERE PostTypeId = 1
    GROUP BY OwnerUserId
    HAVING 
        COUNT(CASE WHEN CreationDate BETWEEN '2021-09-05' AND '2021-11-28' THEN Id ELSE NULL END) >= 1
        AND 
        COUNT(CASE WHEN CreationDate BETWEEN '2021-12-05' AND '2022-02-27' THEN Id ELSE NULL END) >= 1
),
FINAL As(
SELECT 
    ROW_NUMBER() OVER (ORDER BY posts.OwnerUserId DESC) AS IndexColumn,
    posts.OwnerUserId,
    posts.id,
    posts.CreationDate,
    posts.Score,
    posts.CommentCount,
    posts.Viewcount,
    posts.FavoriteCount,
    posts.AnswerCount,
    posts.AcceptedAnswerId,
    len(posts.body) AS  length
FROM posts 
INNER JOIN TempTable ON posts.OwnerUserId = TempTable.OwnerUserId
WHERE PostTypeId=1 AND posts.CreationDate BETWEEN '2021-09-05' AND '2022-02-27'
GROUP BY posts.OwnerUserId, posts.id, posts.CreationDate, posts.Score,posts.CommentCount,posts.Viewcount,posts.FavoriteCount,posts.AnswerCount,posts.AcceptedAnswerId, len(posts.body)
)
Select  *
From FINAL
order by IndexColumn

Enter Parameters

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