title: Sequelize Select models referenced in parent/child tables
body: <p>If I have the following tables</p>
  <p>Post - id, title, content, categoryId</p>
  <p>Category - id, name</p>
  <p>And some categories don't have posts linked to them, how can I select only the categories that are referenced from the Posts table</p>
  <p>I found this in their github issues, but its code from V1, which no longer works, however it demonstrates, I think, what I would like to accomplish</p>
  <pre><code>ModelA.findAll({
    include: [ModelB],
    having: 'count(ModelB.id) &gt; 0'
  });
  </code></pre>
  <p>If <code>ModelB</code> is referenced one or more times in <code>ModelA</code>, include it.</p>
  <p>Edit: I don't really want to include it, as I only need the data from the Category table, and not the Posts table.</p>
  <p>I'm using postgres, if it matters.</p>