# Les requêtes de réponses faites par le personnel incluent des actions telles que ouvrir et fermer des threads

**URL:** <https://meta.discourse.org/t/query-of-replies-made-by-staff-includes-actions-like-opening-and-closing-threads/82535>\
**Category:** Product Support\
**Created:** [Mars 8, 2018, 6:00 UTC](https://meta.discourse.org/t/query-of-replies-made-by-staff-includes-actions-like-opening-and-closing-threads/82535 "2018-03-08T18:00:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jerdog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jerdog/32/122843_2.png) [@jerdog](https://meta.discourse.org/u/jerdog)\
**Post date:** [Mars 8, 2018, 6:00 UTC](https://meta.discourse.org/t/query-of-replies-made-by-staff-includes-actions-like-opening-and-closing-threads/82535/1 "2018-03-08T18:00:47Z")

</div>

I am building queries for my community to be able to fulfill some metrics, and what I am seeing is something I can’t seem to get around. The following query essentially just pulls back all posts made by staff members during a time period, but also includes activities like opening/closing a topic, etc.

```
-- [params]
-- string :start = 2018-03-04 00:00:00
-- string :end = 2018-03-10 23:59:59.999999

SELECT p.user_id, count(p.id) as Replies
    FROM posts p
    WHERE p.created_at between :start and :end AND
        p.user_id IN 
        (select u.id 
            from users u
            where u.primary_group_id = 41) AND
        p.user_id not in ('-1', '-2') AND
        p.topic_id not in ('4','24','26','32','33','34','35','36','37','38','39','40')
GROUP BY p.user_id
ORDER BY Replies DESC

```

I see a `post_action_types` table but it has things like Likes, Bookmarks, etc.. I am trying to get to where I am displaying actual replies by my staff and not just things like “likes” and such

---

_[View the full topic](https://meta.discourse.org/t/query-of-replies-made-by-staff-includes-actions-like-opening-and-closing-threads/82535)._
