# Data explorer query to return certain post notices?

**URL:** <https://meta.discourse.org/t/data-explorer-query-to-return-certain-post-notices/271090>\
**Category:** Data & reporting\
**Tags:** post-notices, sql-query\
**Created:** [November 18, 2020, 3:07am UTC](https://meta.discourse.org/t/data-explorer-query-to-return-certain-post-notices/271090 "2020-11-18T03:07:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![simonk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonk/32/247950_2.png) [@simonk](https://meta.discourse.org/u/simonk)\
**Post date:** [November 19, 2020, 12:20am UTC](https://meta.discourse.org/t/data-explorer-query-to-return-certain-post-notices/271090/4 "2020-11-19T00:20:59Z")

</div>

The post notices are actually stored in the `post_custom_fields` table, so you can get a more precise list of posts like this:

```sql
-- [params]
-- int :days_ago = 7

SELECT p.created_at,
       p.id AS post_id,
       p.user_id,
       pcf.value AS "notice type"
FROM post_custom_fields pcf
INNER JOIN posts p ON pcf.post_id = p.id
INNER JOIN topics t ON p.topic_id = t.id
WHERE pcf.name = 'notice_type'
  AND p.created_at > NOW() - INTERVAL ':days_ago days'
  AND t.archetype = 'regular'
ORDER BY p.created_at ASC

```

---

_[View the full topic](https://meta.discourse.org/t/data-explorer-query-to-return-certain-post-notices/271090)._
