title: How to write nested queries in select clause
body: <p>I'm trying to produce this SQL with SLICK 1.0.0: </p>
  
  <pre><code>    select
      cat.categoryId,
      cat.title,
      (
        select
          count(product.productId)
        from
          products product
          right join products_categories productCategory on productCategory.productId = product.productId
          right join categories c on c.categoryId = productCategory.categoryId
        where
          c.leftValue &gt;= cat.leftValue and
          c.rightValue &lt;= cat.rightValue
      ) as productCount
  from
      categories cat
  where
      cat.parentCategoryId = 2;
  </code></pre>
  
  <p>My most successful attempt is (I dropped the "joins" part, so it's more readable):</p>
  
  <pre><code>def subQuery(c: CategoriesTable.type) = (for {
          p &lt;- ProductsTable
  
        } yield(p.id.count))
        for {
          c &lt;- CategoriesTable
          if (c.parentId === 2)
        } yield(c.id, c.title, (subQuery(c).asColumn))
  </code></pre>
  
  <p>which produces the SQL lacking parenthesis in subquery:</p>
  
  <pre><code>   select 
      x2.categoryId, 
      x2.title, 
      select count(x3.productId) from products x3 
     from 
      categories x2 
     where x2.parentCategoryId = 2
  </code></pre>
  
  <p>which is obviously invalid SQL
  Any thoughts how to have SLICK put these parenthesis in the right place? Or maybe there is a different way to achieve this?</p>