title: SQL WHERE Temporary Column
body: <p>I have this MSSQL Query which works</p>
  
  <pre><code>SELECT c.CategoryName + ' (' + cast(count(ic.CategoryId) as varchar(255)) + ')' AS
   CategoryName, count(ic.CategoryId) AS NumPhotos,
    c.Slug, c.ParentCategoryId, c.Id
  FROM Categories
   c LEFT JOIN
   ItemCategories ic
   on ic.CategoryId = c.Id
  GROUP BY c.CategoryName, c.slug, c.ParentCategoryId, c.id
  ORDER BY ParentCategoryId DESC
  </code></pre>
  
  <p>And I want to return only rows, WHERE NumPhotos>0 but temporary columns are not allowed on SQL WHERE clause</p>