开发者

7 Day Users Stat SQL Query

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜