title: Counting two different fields from two different tables in one query
body: <p>I need to somehow put these two queries into one query:</p>
  
  <h1>1</h1>
  
  <pre><code>select fac_name, datename(month,b.startdt) as 'month', year(b.startdt) as 'year', count(a.empfk) as '#filled'  
  from tbl_tmx_attempt a  
  left outer join tbl_tmx_activity b on a.activityfk = b.activity_pk  
  left outer join tbl_tmx_actloc c on b.activity_pk = c.activityfk  
  left outer join loc d on c.locfk = d.loc_pk  
  left outer join fac e on d.loc_facfk = e.fac_pk  
  where b.startdt &gt; '12/31/08'    
  group by fac_name, year(b.startdt), month(b.startdt), datename(month,b.startdt) 
  </code></pre>
  
  <h1>2</h1>
  
  <pre><code>select fac_name, datename(month,b.startdt) as 'month', year(b.startdt) as 'year', sum(b.maxcapacity) as 'capacity'  
  from tbl_tmx_activity b   
  left outer join tbl_tmx_actloc c on b.activity_pk = c.activityfk  
  left outer join loc d on c.locfk = d.loc_pk  
  left outer join fac e on d.loc_facfk = e.fac_pk  
  where b.startdt &gt; '12/31/08'  
  group by fac_name, year(b.startdt), month(b.startdt), datename(month,b.startdt)  
  </code></pre>
  
  <p>Everything is basically the same except the counts are from different tables counting a different field.  I need the results to be one table showing the capacity and #filled</p>