# 콘텐츠 감사: 카테고리, 주제 및 답변을 가져오는 보고서

**URL:** https://meta.discourse.org/t/content-audit-report-to-pull-categories-topics-and-replies/349354
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [1월 28, 2025, 11:33오전 UTC](https://meta.discourse.org/t/content-audit-report-to-pull-categories-topics-and-replies/349354 "2025-01-28T11:33:58Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![SaraDev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saradev/32/335139_2.png) [@SaraDev](https://meta.discourse.org/u/SaraDev)
#### Post date: [1월 29, 2025, 12:42오전 UTC](https://meta.discourse.org/t/content-audit-report-to-pull-categories-topics-and-replies/349354/3 "2025-01-29T00:42:29Z")

</div>

안녕하세요 @RachFeverBee,

원하시는 정보를 찾는 가장 좋은 방법은 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 쿼리를 사용하는 것입니다.

공유해 주신 주제와 보고 요구 사항 설명에 기반하여, 다음 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 쿼리를 시작점으로 사용할 수 있습니다:

**카테고리, 주제 및 답변**

```sql
-- [params]
-- date :start_date = 2023-01-01
-- date :end_date = 2025-01-28

WITH filtered_topics AS (
    SELECT 
        t.id AS topic_id,
        t.title AS topic_title,
        t.created_at AS topic_created_at,
        t.user_id AS topic_user_id,
        t.category_id AS topic_category_id
    FROM 
        topics t
    WHERE 
        t.created_at BETWEEN :start_date AND :end_date
),
filtered_posts AS (
    SELECT 
        p.id AS post_id,
        p.topic_id,
        p.user_id AS post_user_id,
        p.created_at AS post_created_at,
        p.raw AS post_content,
        p.post_number
    FROM 
        posts p
    WHERE 
        p.created_at BETWEEN :start_date AND :end_date
),
categories_with_topics AS (
    SELECT 
        c.id AS category_id,
        c.name AS category_name,
        ft.topic_id,
        ft.topic_title,
        ft.topic_created_at,
        ft.topic_user_id
    FROM 
        categories c
    JOIN 
        filtered_topics ft ON c.id = ft.topic_category_id
),
final_data AS (
    SELECT 
        cwt.category_name,
        cwt.topic_id,
        cwt.topic_title,
        cwt.topic_created_at,
        cwt.topic_user_id,
        fp.post_id,
        fp.post_content,
        fp.post_created_at,
        fp.post_user_id,
        fp.post_number
    FROM 
        categories_with_topics cwt
    LEFT JOIN 
        filtered_posts fp ON cwt.topic_id = fp.topic_id
)
SELECT 
    fd.category_name AS "Category",
    fd.topic_id AS "Topic ID",
    fd.topic_title AS "Topic Title",
    fd.topic_created_at AS "Topic Created At",
    fd.topic_user_id AS "Topic Poster",
    fd.post_id AS "Post ID",
    fd.post_content AS "Post Content",
    fd.post_created_at AS "Post Created At",
    fd.post_user_id AS "Post Poster",
    fd.post_number AS "Post Number"
FROM 
    final_data fd
ORDER BY 
    fd.topic_created_at ASC, 
    fd.post_created_at ASC

```

이 보고서는 다음 결과를 생성합니다:

- **카테고리 이름** : 카테고리의 이름.
- **주제 ID** : 주제에 대한 링크 가능한 ID.
- **주제 제목** : 주제의 제목.
- **주제 생성 시각** : 주제가 생성된 날짜와 시간.
- **주제 작성자** : 주제를 생성한 사용자.
- **글 ID** : 글에 대한 링크 가능한 ID.
- **글 내용** : 글의 전체 텍스트.
- **글 생성 시각** : 글이 생성된 날짜와 시간.
- **글 작성자** : 글을 작성한 사용자.
- **글 번호** : 주제 내의 글 번호.

_예시 결과_

| 카테고리 | 주제 ID | 주제 제목 | 주제 생성 시각 | 주제 작성자 | 글 ID | 글 내용 | 글 생성 시각 | 글 작성자 | 글 번호 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 일반 토론 | 101 | 포럼에 오신 것을 환영합니다! | 2023-01-02 10:00:00 UTC | 1 | 201 | 여러분, 안녕하세요! 환영합니다! | 2023-01-02 10:05:00 UTC | 2 | 1 |
| 일반 토론 | 101 | 포럼에 오신 것을 환영합니다! | 2023-01-02 10:00:00 UTC | 1 | 202 | 따뜻한 환영에 감사합니다! | 2023-01-02 10:10:00 UTC | 3 | 2 |
| 기술 지원 | 102 | 내 기기를 초기화하는 방법? | 2023-02-15 14:30:00 UTC | 4 | 203 | 누군가 이 기기를 초기화하는 데 도움을 줄 수 있나요? | 2023-02-15 14:35:00 UTC | 4 | 1 |
| 기술 지원 | 102 | 내 기기를 초기화하는 방법? | 2023-02-15 14:30:00 UTC | 4 | 204 | 물론이죠, 여기 단계가 있습니다… | 2023-02-15 14:40:00 UTC | 5 | 2 |
| 공지사항 | 103 | 새로운 기능이 출시되었습니다! | 2023-03-01 09:00:00 UTC | 6 | 205 | 새로운 기능을 확인해 보세요! | 2023-03-01 09:05:00 UTC | 6 | 1 |

원하는 결과 표시 방식에 따라 끝에 있는 `ORDER BY` 구문을 조정하여 쿼리 결과의 정렬 방식을 변경할 수 있습니다. 또한, 사이트에 많은 수의 주제와 글이 있는 경우 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 플러그인에서 [결과 제한](https://meta.discourse.org/t/discourse-data-explorer/32566#p-138280-result-limits-and-exporting-queries-7)을 염두에 두어야 할 수 있습니다.

---

_[View the full topic](https://meta.discourse.org/t/content-audit-report-to-pull-categories-topics-and-replies/349354)._
