# 데이터 탐색기 쿼리: 답변이 없는 게시물 찾기

**URL:** <https://meta.discourse.org/t/data-explorer-query-find-posts-without-replies/179767>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [2월 15, 2021, 11:49오전 UTC](https://meta.discourse.org/t/data-explorer-query-find-posts-without-replies/179767 "2021-02-15T11:49:43Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![michebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michebs/32/190102_2.png) [@michebs](https://meta.discourse.org/u/michebs)\
**Post date:** [2월 15, 2021, 4:58오후 UTC](https://meta.discourse.org/t/data-explorer-query-find-posts-without-replies/179767/4 "2021-02-15T16:58:50Z")

</div>

> [@Ed\_Bobkov](#):
>
> 정확합니다 (쿼리에 토픽을 포함하지 않아야 합니다)/

삭제된 토픽에 연결된 게시물도 무시되었습니다.

> [@Ed\_Bobkov](#):
>
> (현재 시간 - 24시간) 타임스탬프부터 1개월

쿼리에서 고려된 기간: `period_start: 2021-01-14` / `period_end: 2021-02-14`

```sql
-- [params]
-- int :months_ago = 1

WITH query_period as (
    SELECT
        DATE_TRUNC('day', CURRENT_DATE - INTERVAL '1 day') - INTERVAL ':months_ago months' AS period_start,
        (CURRENT_DATE - INTERVAL '1 day') AS period_end
)

SELECT 
    p.created_at,
    p.topic_id,
    p.id AS post_id,
    p.like_count,
    p.post_number,
    p.reply_count
FROM posts p
INNER JOIN topics t ON t.id = p.topic_id
WHERE p.reply_count = 0
    AND p.post_number > 1
    AND t.category_id IN (48, 23)
    AND p.deleted_at IS NULL
    AND t.deleted_at IS NULL
    AND p.created_at >= (SELECT period_start FROM query_period)
    AND p.created_at <= (SELECT period_end FROM query_period) 

```

---

_[View the full topic](https://meta.discourse.org/t/data-explorer-query-find-posts-without-replies/179767)._
