title: SQL Query to compare 2 weeks
body: <p>I've got to design a query in visual studio where I have 2 data sets.</p>
  
  <p>basically it goes like this.</p>
  
  <p>I want to compare this weeks call total to last week per country calling.
  the only thing is last weeks calls may have come from 20 diff countries while this weeks might only have come from 15. 
  How can I make the query such that the 20 countries will show up for both while having "0" value in for countries that do not appear this week.</p>
  
  <p>below is my query:</p>
  
  <pre><code>Select country, 
          Sum(Case When actstatus in (5,105) Then 1 Else 0 End) As TotalCalls,
          Sum(Case When actstatus = 105 Then 1 Else 0 End) As FailedCalls
  From  termactivity(nolock)  
      INNER JOIN termconfig(NOLOCK) ON cfgterminalID = actterminalID 
      INNER JOIN Country (nolock) on country = cycode
  
  Where  actstatus in (5,105)
  and  (actTerminalDateTime BETWEEN @StartDate-7 AND @EndDate-7)
  
  Group By country
  order By country asc
  </code></pre>
  
  <p>When Act status = 105 it means the call was not completed and when it = 5 it means the call was successful. I am doing this to get a successful call % rate per week.
  Thanks in Advance!</p>