# 能否生成未在特定主题中发帖的用户报告？

**URL:** <https://meta.discourse.org/t/can-i-generate-a-report-of-users-who-have-not-posted-in-a-given-topic/111425>\
**Category:** Product Support\
**Created:** [2019 年3 月 12 日 21:08 UTC](https://meta.discourse.org/t/can-i-generate-a-report-of-users-who-have-not-posted-in-a-given-topic/111425 "2019-03-12T21:08:35Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

作者： ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)\
发布日期： [2019 年3 月 12 日 21:38 UTC](https://meta.discourse.org/t/can-i-generate-a-report-of-users-who-have-not-posted-in-a-given-topic/111425/4 "2019-03-12T21:38:31Z")

</div>

With [data explorer](https://meta.discourse.org/t/32566?silent=true), something like this should do the trick, for a given topic:

```plaintext
-- [params]
-- int :topic_id = 1

SELECT id, username
FROM users u
WHERE u.id NOT IN 
(SELECT user_id FROM posts WHERE topic_id=:topic_id)

```

And for users who have not posted in a given category, something like:

```plaintext
-- [params]
-- int :cat_id = 1

SELECT id, username
FROM users u
WHERE u.id NOT IN 
(SELECT user_id FROM posts WHERE topic_id IN
    (SELECT id from topics where category_id=:cat_id)
)

```

(You can find category ids by running `select id, name from categories`).

Hmm actually that second query doesn’t seem to work for me for all categories though, not sure why, maybe someone else can test / tweak if needed!

---

_[View the full topic](https://meta.discourse.org/t/can-i-generate-a-report-of-users-who-have-not-posted-in-a-given-topic/111425)._
