title: MySQL - Counting two things with different conditions
body: <p>I want to count two things under different conditions in one query.</p>
  
  <pre><code>SELECT COUNT(*) AS count FROM table_name WHERE name = ?
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT COUNT(*) as count FROM table_name WHERE address = ? AND port = ?
  </code></pre>
  
  <p>I need to have a count for rows that have a certain address and certain port, and a SEPARATE count for rows that have a certain name.</p>
  
  <p>I'm aware that I could do</p>
  
  <pre><code>SELECT (COUNT*) as count FROM table_name WHERE (address = ? AND port = ?) OR name = ?
  </code></pre>
  
  <p>However that is a single count, and I need them to be separate so I can display a more accurate message to the user.</p>
  
  <p>How might I go about doing this? Help would be appreciated!</p>