데이터 탐색기 - 투표 수

안녕하세요!

Data Explorer 플러그인을 사용 중이며, Feedback 카테고리 내의 주제(topics)를 가져오려고 하고 있습니다. 다음 쿼리를 사용하면 잘 작동합니다:

SELECT
    t.id AS topic_id,
    t.title AS topic_title,
    t.excerpt,
    t.like_count,
    ('https://our_community.com/t/' || t.slug || '/' || t.id) AS url
FROM 
    topics t
WHERE 
    t.category_id = 95
AND 
    t.created_at > NOW() - INTERVAL '2 years'
AND deleted_at IS NULL

불확실한 점은 Topic Voting 플러그인과 관련된 투표 수(vote count)를 어떻게 함께 포함할 수 있는지에 대한 것입니다. 위의 쿼리에 각 게시글별로 투표 수를 포함하는 방법을 아시는 분 계신가요?

토픽 투표 테이블은 discourse_voting_topic_votes와 discourse_voting_votes입니다. 각 토픽의 투표 수를 포함하려면 다음과 같은 쿼리를 사용할 수 있습니다: :+1:


SELECT
    t.id AS topic_id,
    t.title AS topic_title,
    dvtv.votes_count,
    t.excerpt,
    t.like_count,
    ('https://our_community.com/t/' || t.slug || '/' || t.id) AS url
FROM 
    topics t
JOIN 
    discourse_voting_topic_vote_count dvtv ON t.id = dvtv.topic_id
WHERE 
    t.category_id = 95
AND 
    t.created_at > NOW() - INTERVAL '2 years'
AND deleted_at IS NULL

#data-reporting 카테고리에서 유용하게 사용할 수 있는 몇 가지 추가 쿼리도 있습니다 - Topics tagged topic-voting

감사합니다 @JammyDodger ! :heart: