title: mysql query to concat information from 3 tables - getting incorrect result count
body: <p>I have 3 tables in my database.</p>
  
  <blockquote>
    <ul>
    <li>ab_contacts
    <ul>
    <li>id</li>
    <li>first_name</li>
    <li>last_name</li>
    <li>addressbook_id </li>
    <li>etc (more, but these are the relevant ones)   </li>
    </ul></li>
    <li>ab_addressbooks
    <ul>
    <li>name</li>
    <li>id</li>
    </ul></li>
    <li>co_comments
    <ul>
    <li>id</li>
    <li>link_id</li>
    <li>comment</li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p>I'd like to create a query that will let me select all the contacts and comments related to them in a given addressbook.  </p>
  
  <p>To select all the people in a given addressbook, I can use:</p>
  
  <p><code>select count(*) from ab_contacts where addressbook_id = '50';</code></p>
  
  <p>This returns 8152 people.</p>
  
  <p>However, when I run my query:</p>
  
  <pre><code>select
    ab_addressbooks.name,
    ab_contacts.first_name,
    ab_contacts.last_name,
    ab_contacts.email,
    ab_contacts.email2,
    ab_contacts.email3,
    ab_contacts.function,
    ab_contacts.address,
    ab_contacts.address_no,
    ab_contacts.city,
    ab_contacts.state,
    ab_contacts.zip,
    ab_contacts.home_phone,
    ab_contacts.work_phone,
    ab_contacts.cellular,
    REPLACE(REPLACE(REPLACE(ab_contacts.comment, '\r', ', '), '\n', ', '), '\\', '') AS comment,
    REPLACE(REPLACE(REPLACE(group_concat(co_comments.comments separator ', '), '\r', ', '), '\n', ', '), '\\', '') AS comment2
  from ab_contacts
  LEFT JOIN ab_addressbooks ON (ab_contacts.addressbook_id = ab_addressbooks.id)
  LEFT JOIN co_comments ON (ab_contacts.id = co_comments.link_id)
  WHERE ab_contacts.addressbook_id = '344';`
  </code></pre>
  
  <p>the format works, but I only get 1045 results.  I'm sure there is something I am missing, but I cannot figure it out.  Any help would be greatly appreciated.</p>