title: Counting inside select knex js
body: <p>I have two sets of tables which look as follows</p>
  
  <p><strong>User table</strong></p>
  
  <pre><code>|  id| name |
  |----|------|
  |  1 |  x   |
  |  2 |  y   |
  |  3 |  z   |
  </code></pre>
  
  <p><strong>Visits table</strong></p>
  
  <pre><code>| event_id | user_id |
  |----------|---------|
  |     1    |  1      |
  |     2    |  2      |
  |     3    |  3      |
  |     4    |  1      |
  |     5    |  1      |
  |     1    |  2      |
  </code></pre>
  
  <p>How do i get the number of visits by each user along with the name of the user. 
  I know raw SQL can be used with knex and I can easily do this with a SQL query. I curious to know if this is possible using only knex js.</p>
  
  <pre><code>await knex('visits').count().groupBy('user_id');
  </code></pre>
  
  <p>The above query would give me the count of visits by each user. How do i get the name of the user in the same query.</p>
  
  <p>I am looking for an output which looks like below</p>
  
  <pre><code>| user_id  | name | count |
  |----------|------|-------|
  |     1    |  x   |   3   |
  |     2    |  y   |   2   |
  |     3    |  z   |   1   |
  </code></pre>