Use Count() with self join in SQL Server
<p>I'm working with the northwind database and my exercise is:</p>

<blockquote>
  <p>Which suppliers offer two products in the same category? Show company name, category and the both product names</p>
</blockquote>

<p>My code:</p>

<pre><code>SELECT DISTINCT 
    c.CategoryID, s.CompanyName, p1.ProductName, p2.ProductName
FROM 
    Suppliers s 
INNER JOIN 
    Products p1 ON s.SupplierID = p1.SupplierID
INNER JOIN 
    Products p2 ON p1.CategoryID = p2.CategoryID 
                AND p1.ProductID &lt;&gt; p2.ProductID
INNER JOIN 
    Categories c ON p2.CategoryID = c.CategoryID
GROUP BY 
    c.CategoryID,s.CompanyName, p1.ProductName, p2.ProductName`
</code></pre>

<p>How can I filter that with <code>COUNT()</code> I tried to do it with <code>HAVING</code> but I failed.
I'll appreciate some help, which bringing me back on the right way.</p>