title: Django - Need helping writing annotated query
body: <p>I'm trying to better understand how to write some more advanced queries. I'm used to the basic Model.objects.all() and .filter(), etc, but I'm having trouble writing out queries that are annotated.</p>
  <p>Here is my model setup (I have removed any additional fields that are not necessary for this question):</p>
  <pre><code>from django.db import models
  
  class Client(models.Model): 
      name = models.CharField(max_length=100)
  
  class Project(models.Model): 
      client = models.ForeignKey(Client, on_delete=models.CASCADE)
  
  class Campaign(models.Model): 
      project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name=&quot;campaigns&quot;)
  
  class Advertisement(models.Model): 
      campaign = models.ForeignKey(Campaign, on_delete=models.CASCADE, related_name='advertisements')
  </code></pre>
  <p>What I need is a query that shows how many Advertisements each client has, ordered by most to least.</p>
  <p>I'm trying to follow the docs from here: <a href="https://docs.djangoproject.com/en/4.0/topics/db/aggregation/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/4.0/topics/db/aggregation/</a> but their annotation example isn't as nested, the publisher model example is a foreign key on the book object, where as with mine the client is a foreign key of a project, which is a foreign key of a campaign, which is a foreign key of advertisements.</p>
  <p>Any advice on how to drill down through the layers of the models to get the info I need?</p>