开发者

7 Day Users Stat SQL Query

开发者 https://www.devze.com 2023-01-18 15:54 出处:网络
Can someone help me with a SQL Query that will display all users that have made a post every day for the last 7 days?

Can someone help me with a SQL Query that will display all users that have made a post every day for the last 7 days?

My questions table is tblQA and my users are userID and questionID for the post. I want to run a query that helps me know how many active users are using the database every day.

开发者_如何转开发

Thanks so much!


SELECT userID
FROM tblQ
WHERE DATEDIFF(NOW(),postdate) < 7
GROUP BY userID
HAVING COUNT(DISTINCT DATE(postdate)) = 7
0

精彩评论

暂无评论...
验证码 换一张
取 消