title: MySQL Left Join Subselect
body: <p>I have a simple table of languages / template id's:</p>
  
  <p>language | template</p>
  
  <p>en, t1<br />
  en, t1<br />
  au, t2<br />
  ge, t3<br />
  en, t1<br />
  ge, t2<br />
  ge, t3</p>
  
  <p>Template is always either t1,t2, or t3. In total there are 3 languages: en, au, ge.</p>
  
  <p>There is lots more information in the table, I am just showing what is relevant to this question, I will be using the data for graphing and so need it returning in this format:</p>
  
  <p>en, t1, 3<br />
  en, t2, 0<br />
  en, t3, 0<br />
  au, t1, 0<br />
  au, t2, 1<br />
  au, t3, 0<br />
  ge, t1, 0<br />
  ge, t2, 1<br />
  ge, t3, 2</p>
  
  <p>This counts however many template occurrences there are in each language. But, the problem I have is returning a zero count if there are no template id's for that particular language in the table.</p>
  
  <p>I was thinking it would need some sort of left join sub select on the template id to make sure the 3 template id's are returned for each language?</p>