# How do I count topics in sub-categories?

**URL:** <https://meta.discourse.org/t/how-do-i-count-topics-in-sub-categories/62085>\
**Category:** Product Support\
**Created:** [4. Mai 2017 um 02:08 UTC](https://meta.discourse.org/t/how-do-i-count-topics-in-sub-categories/62085 "2017-05-04T02:08:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [4. Mai 2017 um 02:56 UTC](https://meta.discourse.org/t/how-do-i-count-topics-in-sub-categories/62085/4 "2017-05-04T02:56:00Z")

</div>

Here are some quick [Data Explorer](https://meta.discourse.org/t/32566?silent=true) queries in case you need to do this more in the future.

Query to get topic count for one category (or subcategory).

```plaintext
-- [params]
-- null string_list :category_name
SELECT topic_count FROM categories
WHERE categories.name = :category_name

```

Query to list all categories (and subcategories) and their topic counts:

```plaintext
SELECT name, topic_count FROM categories

```

---

_[View the full topic](https://meta.discourse.org/t/how-do-i-count-topics-in-sub-categories/62085)._
