title: mysql join statement
body: <p>I have a category page in which i am displaying all images coming under a particular category...I also have a dropdown using which i can sort the images based on number of stories written for that image...
  To accomplish this i am using JOIN statement coz media and story are two different tables...</p>
  
  <pre><code>media table has mediaid,catid,userid,link
  </code></pre>
  
  <p>and</p>
  
  <pre><code>story table has storyid,mediaid,storyheading,storycontent
  </code></pre>
  
  <p>i am using JOIN statement in this way...</p>
  
  <pre><code>SELECT count(story.id) as cnt,story.mediaid as id,media.cat_id,media.link,media.userid 
  FROM story RIGHT JOIN 
  media ON story.mediaid=media.mediaid where cat_id='25' group by story.mediaid order by cnt desc limit 0,8
  </code></pre>
  
  <p>but i get only the images that has stories...i wanted all the result such that even if there is no story for a particular image we can show 0 stories...can we do that by not changing the table structure and just changing the sql statement??
  Please help...<em>-</em></p>