<p>You could do it like this:</p>

<p><code>{% set categories = craft.categories.relatedTo({
    sourceElement: craft.entries.limit(null)
}) %}
</code></p>

<p>reference: <a href="https://craftcms.slack.com/archives/help/p1429030702000608" rel="nofollow">https://craftcms.slack.com/archives/help/p1429030702000608</a></p>

CC BY-SA 3.0
2015-04-14T17:40:08.430Z
Is there a slack group? And if so, how would one get access to it?
Douglas McDonald
CC BY-SA 3.0
2015-04-15T09:41:24.510Z
@Douglas http://buildwithcraft.com/community
carlcs
CC BY-SA 3.0
2015-04-15T16:08:28.110Z
@carlcs don't know how i missed that. Thanks.
Douglas McDonald
CC BY-SA 3.0
2015-04-14T17:03:46.807Z
2015-04-14T17:03:46.807Z
Luke Holder
<p>I want all categories that have at least one entry that uses it.</p>

CC BY-SA 3.0
2015-04-14T20:44:09.570Z
Luke, this is an exact duplicate of Russ's question. Feel free to provide an answer over on that thread. :)
Lindsey D
<categories><relations>
How do I get all categories with at least one entry
# How do I get all categories with at least one entry

(Asked by: username_0 on 2015-04-14)

I want all categories that have at least one entry that uses it.

**Tags:** categories, relations

> **Comments:**
> **username_1**: Luke, this is an exact duplicate of Russ's question. Feel free to provide an answer over on that thread. :)  

---

## 1 answers

### Answer by username_0 on 2015-04-14. Score: 1

You could do it like this:

`{% set categories = craft.categories.relatedTo({
sourceElement: craft.entries.limit(null)
}) %}`

reference: <https://craftcms.slack.com/archives/help/p1429030702000608>

> **Comments:**
> **username_2**: Is there a slack group? And if so, how would one get access to it?  
> **username_3**: @Douglas http://buildwithcraft.com/community  
> **username_2**: @username_3 don't know how i missed that. Thanks.  

---

