title: Mysql two queries in one (inner join?)
body: <p>I need to return the results of two queries within one. I've read other posts and am not sure if this should be an inner join.</p>
  
  <p>I would like these two queries:</p>
  
  <pre><code>MariaDB [servers]&gt; select * from servers;
  +----+------------+---------+------------+
  | id | servername | ip      | returncode |
  +----+------------+---------+------------+
  |  1 | server1    | 0.0.0.0 | 0          |
  |  2 | server2    | 0.0.0.0 | 1          |
  |  3 | server2    | 0.0.0.0 | 0          |
  |  4 | server3    | 0.0.0.0 | 0          |
  |  5 | server3    | 0.0.0.0 | 4          |
  |  6 | server3    | 0.0.0.0 | 4          |
  |  7 | server3    | 0.0.0.0 | 4          |
  +----+------------+---------+------------+
  
  MariaDB [servers]&gt; select servername,count(returncode) from servers where returncode&lt;&gt;0 group by servername;
  +------------+-------------------+
  | servername | count(returncode) |
  +------------+-------------------+
  | server2    |                 1 |
  | server3    |                 3 |
  +------------+-------------------+
  </code></pre>
  
  <p>Into something like this:</p>
  
  <pre><code>MariaDB [servers]&gt; select ?????????
  +----+------------+---------+------------+-------------------+
  | id | servername | ip      | returncode | count(returncode) |
  +----+------------+---------+------------+-------------------+
  |  1 | server1    | 0.0.0.0 | 0          | 0                 |
  |  2 | server2    | 0.0.0.0 | 1          | 1                 |
  |  3 | server2    | 0.0.0.0 | 0          | 1                 |
  |  4 | server3    | 0.0.0.0 | 0          | 3                 |
  |  5 | server3    | 0.0.0.0 | 4          | 3                 |
  |  6 | server3    | 0.0.0.0 | 4          | 3                 |
  |  7 | server3    | 0.0.0.0 | 4          | 3                 |
  +----+------------+---------+------------+-------------------+
  </code></pre>
  
  <p>Can someone please help me understand how to do this? I feel like this is an inner join, however I'm not sure I understand this concept completely..</p>