title: join count from one table to select from another - mysql
body: <p>I have a select query with a subquery in it on table a:</p>
  
  <pre><code>select UserName, Name, anniversaryDate, RegionCode 
  from a where UserName in
  (
      select Username from
      (
          select Username, max(timeUsed)
          from log_table where role='Cou'
          group by Username order by max(timeUsed) desc limit 10
      ) a
  )
  </code></pre>
  
  <p>which works fine, now I have another table called b,
  on that table I only have 3 columns:</p>
  
  <p>UserName, PName and feedback</p>
  
  <p>which have each UserName multiple times and I want to join to my first query the count of each UserName I got from the first query.</p>
  
  <p>for eaxmple:</p>
  
  <pre><code>SELECT COUNT(UserName) FROM b where UserName='Admin' group by UserName
  </code></pre>
  
  <p>How do I join the results from the second query to the first one?</p>
  
  <p>Tables:<br><br>
  log_table :<br>
  id - Int, AI, PK<br>
  Username - varchar<br>
  Action - Int<br>
  timeUsed - Datetime<br>
  role - varchat<br></p>
  
  <p>a:<br>
  UserName - varchar, PK<br>
  Name - varchar<br>
  anniversaryDate - Datetime<br>
  RegionCode - Int<br></p>
  
  <p>b:<br>
  UserName - varchar<br>
  PName - varchar<br>
  feedback - varchar</p>