Number of topics in a category

How can I see how many topics a category consist of?

Hey Toni,

Does this Data Explorer query work for your needs? It will show you a count of topics and posts in each category:

image

SELECT category_id, 
       stats.topic_count, 
       stats.post_count 
FROM   categories ccc 
       LEFT JOIN (SELECT topics.category_id, 
                         Count(*)       topic_count,
                         SUM(topics.posts_count) post_count
                         FROM   topics 
                          
                  WHERE  ( "topics"."deleted_at" IS NULL ) 
                         AND ( topics.id NOT IN (SELECT cc.topic_id 
                                                 FROM   categories cc 
                                                 WHERE  topic_id IS NOT NULL) ) 
                         AND "topics"."visible" = true 
                  GROUP  BY topics.category_id 
                        ) stats 
              ON stats.category_id = ccc.id
3 Likes

Awesome, thanks @rishabh

1 Like

Isn’t this possible by visiting the categories page? Categories - Discourse Meta

1 Like

Yeah, it is. I don’t know how I missed that.

2 Likes

Now I know - it shows it on meta, but not on our community since we are using the boxes layout (and it doesn’t have the count apparently)

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.