과거 할당 사항 검색

Data Explorer 플러그인을 사용하여 이 데이터를 추출할 수 있습니다.

아래 쿼리가 도움이 되길 바랍니다.

1. 현재 그룹에 할당된 모든 토픽 나열
SELECT 
    g.name group_name,
    a.topic_id,
    a.assigned_by_user_id,
    a.created_at
FROM assignments a
INNER JOIN groups g ON g.id = a.assigned_to_id
WHERE assigned_to_type = 'Group'
ORDER BY g.name, created_at DESC
2. 토픽을 그룹에 할당한 이력 나열
SELECT 
    pcf.value AS group,
    p.topic_id,
    p.user_id AS "assigned_by_user_id",
    pcf.created_at::date
FROM posts p
INNER JOIN post_custom_fields pcf ON pcf.post_id = p.id
WHERE action_code = 'assigned_group'
    AND pcf.name = 'action_code_who'
ORDER BY pcf.value, pcf.created_at DESC