title: JOOQ - Select count inside select query
body: <p>I have a problem while converting the following statement into <code>jooq API</code>:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT t1.col1, t1.col2, t1.col3, (SELECT count(*) FROM table2 where table2.col2 = t1.col1)
  FROM table1 t1
  </code></pre>
  
  <p>I tried it with <code>DSL.count()</code> and <code>DSL.selectCount()</code> but I failed while searching a way to add the where clause to the count subquery.</p>
  
  <p>The database is PostgreSQL 9.6.</p>