# Active Readers (Past Month)

**URL:** https://meta.discourse.org/t/active-readers-past-month/275135
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [1 Maio , 2016 05:15 UTC](https://meta.discourse.org/t/active-readers-past-month/275135 "2016-05-01T05:15:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [1 Maio , 2016 05:15 UTC](https://meta.discourse.org/t/active-readers-past-month/275135/1 "2016-05-01T05:15:00Z")

</div>

### Active Readers (Past Month)

Users with the most visits that include reading activity

```sql
select user_id, 
    count(1) as visits,
    sum(posts_read) as posts_read
from user_visits
where posts_read > 0
and visited_at > CURRENT_TIMESTAMP - INTERVAL '30 days'
group by user_id
order by visits desc, posts_read desc

```
