# User\_stats con un timestamp corretto

**URL:** <https://meta.discourse.org/t/user-stats-with-a-proper-time-stamp/143066>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [2 Marzo 2020, 11:00am UTC](https://meta.discourse.org/t/user-stats-with-a-proper-time-stamp/143066 "2020-03-02T11:00:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2 Marzo 2020, 11:10am UTC](https://meta.discourse.org/t/user-stats-with-a-proper-time-stamp/143066/2 "2020-03-02T11:10:00Z")

</div>

Dovrai generare le statistiche tu stesso utilizzando una nuova query al database. Ad esempio, per ottenere il numero di post degli ultimi 30 giorni

```sql
SELECT count(*) from posts 
WHERE user_id=1
AND created_at > CURRENT_TIMESTAMP - INTERVAL '30 days'

```

Questo argomento contiene molte query di esempio che puoi utilizzare come punto di partenza

> [@(Superseded) What cool data explorer queries have you come up with?](https://meta.discourse.org/t/what-cool-data-explorer-queries-have-you-come-up-with/43516?u=david):
>
> This topic became too long to be easily searched and has been broken down into separate topics. If you have any questions about how to write a [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query, or have one to share, please start a new topic in the #Data & reporting category and tag it with the #sql-query tag. +1information_source For an alternative searchable list of queries that were in this topic, see @SidV’s [query list on GitHub](https://github.com/SidVal/discourse-data-explorer/blob/queries/querys.md).

---

_[View the full topic](https://meta.discourse.org/t/user-stats-with-a-proper-time-stamp/143066)._
