title: Why does the group_concat bring one row with null values when there are no rows at all
body: <p>I have a table post as p, table tags as pt and table tagsref as ptr.</p>
  
  <p>tagsref will have the id's of post and tags table.</p>
  
  <p>i used group_concat and i did not use group by clause because in the condition i am using an if condition to filter only one row (p.slug = 'once') assuming that since i had added the condition only one row will return. yes it did.</p>
  
  <p>The problem is when there are no rows still i got a row with null values. in the following sql the last condition will not fetch any result because there are no rows with slug as 'none' so i should not get any result at all but i got one row with null values.</p>
  
  <pre><code>SELECT p.name, p.slug, GROUP_CONCAT(pt.name) as catz 
  FROM post_tags pt, post_tagsref ptr, post p  
  WHERE p.id = ptr.tid AND ptr.cid = pt.id  AND p.slug = 'none'
  </code></pre>
  
  <blockquote>
    <p>People suggested to use group by clause and mentioned that group_by
    aggregate functions will work even the group by clause is not
    specified but the result may be unpredictable.</p>
  </blockquote>
  
  <p><strong><em>i used group by and is working. yet.</em></strong></p>
  
  <pre><code>post
  -----
  id  |   name    |   slug
  1   |   sam     |   sam
  2   |   do do   |   do-do
  
  post_tags
  --------------
  id  |   name    |   slug
  1   |   music   |   music
  2   |   movies  |   movies
  3   |   tv      |   tv
  
  post_tagsref
  ------------    
  pid |   pcid
  1   |   2
  1   |   1
  2   |   1
  </code></pre>
  
  <p>The above is the table structure.</p>
  
  <p>If there are no rows at all then why is group_concat returning one row with null values?</p>
  
  <p>The reason for a question like this is to make sure what is what... :)</p>
  
  <p><strong>Reference:</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/3974055/query-is-resulting-in-1-row-with-null-values-when-id-is-not-found">Query is resulting in 1 row with null values when id is not found</a></p>