# How can I count posts in last month by a specific group of users?

**URL:** https://meta.discourse.org/t/how-can-i-count-posts-in-last-month-by-a-specific-group-of-users/52489
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [2016 年11 月 4 日 10:12 UTC](https://meta.discourse.org/t/how-can-i-count-posts-in-last-month-by-a-specific-group-of-users/52489 "2016-11-04T10:12:49Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### 作者： ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### 发布日期： [2016 年11 月 8 日 21:54 UTC](https://meta.discourse.org/t/how-can-i-count-posts-in-last-month-by-a-specific-group-of-users/52489/3 "2016-11-08T21:54:22Z")

</div>

Is this close?

> [@Posts created for period](https://meta.discourse.org/t/posts-created-for-period/275138):
>
> Posts created for period Got what I need (thanks @meglio) so updating this for future posterity. -- [params] -- date :date\_from -- date :date\_to -- int :min\_posts = 1 WITH user\_activity AS ( SELECT p.user\_id, count (p.id) as posts\_count FROM posts p LEFT JOIN topics t ON t.id = p.topic\_id WHERE p.created\_at::date BETWEEN :date\_from::date AND :date\_to::date AND t.deleted\_at IS NULL AND t.visible = TRUE AND t.closed = FALSE AND t.archived = FALSE…

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-count-posts-in-last-month-by-a-specific-group-of-users/52489)._
