简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM