Answers.Body: <p>Add this to your chain...</p>
  
  <pre><code>.yourCategoryField(':notempty:')
  </code></pre>
  
  <p>It's not very well documented, but you can see it described in <a href="https://craftcms.stackexchange.com/a/453/45">this old SE thread</a>. In the docs, it's mentioned very briefly <a href="https://docs.craftcms.com/api/v3/craft-helpers-db.html#method-parseparam" rel="nofollow noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-23T17:26:36.320Z
Answers.Text: Hi Lindsey, Thanks for your answer.  Unfortunately, that would give me all entries that have a Category associated to it.  I want it the other way around.  I need all Categories that were assigned at least once somewhere.
Answers.UserDisplayName: Eric Chantigny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-23T16:47:36.547Z
Answers.LastActivityDate: 2018-10-23T16:47:36.547Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm looking for a way to query all categories that have at least one relation.  I'm not looking for the relatedTo() parameter, which would give me categories related to something specific.</p>
  
  <p>Basically, if we talk in Wordpress terms, I'm looking for hideEmpty = true.</p>
  
  <p>Is there anything like that in Craft?</p>
  
  <pre><code>Something like: craft.categories.group('products').hasRelated()
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-23T19:13:14.197Z
Comments.Text: To get this going, I used the cached loop through all the categories and using relatedTo(category) to create a cached list of IDs.
  Based on this thread: https://craftcms.stackexchange.com/questions/11151/only-fetch-categories-that-are-related-to-a-minimum-of-entries?rq=1
Comments.UserDisplayName: Eric Chantigny
Tags: <templating><categories><query>
Title: Is there a query parameter to get categories that are related to anything else?
ThreadText: # Is there a query parameter to get categories that are related to anything else?
  
  (Asked by: username_0 on 2018-10-23)
  
  I'm looking for a way to query all categories that have at least one relation. I'm not looking for the relatedTo() parameter, which would give me categories related to something specific.
  
  Basically, if we talk in Wordpress terms, I'm looking for hideEmpty = true.
  
  Is there anything like that in Craft?
  
  ```
  Something like: craft.categories.group('products').hasRelated()
  
  ```
  
  **Tags:** templating, categories, query
  
  > **Comments:**
  > **username_0**: To get this going, I used the cached loop through all the categories and using relatedTo(category) to create a cached list of IDs. Based on this thread: https://craftcms.stackexchange.com/questions/11151/only-fetch-categories-that-are-related-to-a-minimum-of-entries?rq=1  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-23. Score: 1
  
  Add this to your chain...
  
  ```
  .yourCategoryField(':notempty:')
  
  ```
  
  It's not very well documented, but you can see it described in [this old SE thread](https://craftcms.stackexchange.com/a/453/45). In the docs, it's mentioned very briefly [here](https://docs.craftcms.com/api/v3/craft-helpers-db.html#method-parseparam).
  
  > **Comments:**
  > **username_0**: Hi username_1, Thanks for your answer.  Unfortunately, that would give me all entries that have a Category associated to it.  I want it the other way around.  I need all Categories that were assigned at least once somewhere.  
  
  ---
  
  