title: MySQL: need to get a count of rows
body: <p>I'm trying to do a SQL query which also spits out a number of qualifying rows from a different table, as a result.</p>
  
  <p>Here's the current query, as inserted into sprintf:</p>
  
  <blockquote>
    <p>SELECT a.* FROM <code>websites</code> AS a
    WHERE <code>website_id</code> = %d</p>
  </blockquote>
  
  <p>Then, I have a query for retrieving the number of unique visits (from a table of visits) for a given site:</p>
  
  <blockquote>
    <p>SELECT * FROM <code>website_visits</code> WHERE
    <code>website_id</code> = %d GROUP BY
    <code>visitor_id</code></p>
  </blockquote>
  
  <p>Now, is there any way to insert that query inside the first one, so that I can retrieve the number of unique visits, as part of the result of the first query?  It would have to be something like this:</p>
  
  <blockquote>
    <p>SELECT a.*, (SELECT * FROM
    <code>website_visits</code> AS b WHERE
    b.<code>website_id</code> = a.<code>website_id</code> GROUP
    BY <code>visitor_id</code>) AS unique_visits FROM
    <code>websites</code> AS a WHERE <code>website_id</code> =
    %d</p>
  </blockquote>
  
  <p>But... as to the execution end, I'm stumped.  Any help you can provide is appreciated!</p>