title: SQL Join for two scripts
body: <p>I am trying to join two script </p>
  
  <pre><code>--script 1         
  select  
      t.vendor_code,
      RTRIM(LTRIM(cast(datename(month, [CLOSED_DATE]) as char(15))))+',' + RTRIM(LTRIM(cast(year([CLOSED_DATE]) as char(20)))) as [CLOSED_DATE],
      count(t.vendor_code) as [No_of_Case] 
  from 
      dbo.FTX_FA_CASE t WITH (NOLOCK) 
  where 
      [CLOSED_DATE] is not null 
  group by  
      t.vendor_code, CLOSED_DATE
  </code></pre>
  
  <p>and </p>
  
  <pre><code>--script 2  
  SELECT  
      (RTRIM(LTRIM(cast(datename(month, [dates]) as char(15))))+',' + RTRIM(LTRIM(cast(year([dates]) as char(20)))) + ',') 
  FROM 
      efoxsfc.dbo.FTX_FA_Calender 
  WHERE 
      1 = 1 
      AND CAST(dates AS DATETIME) &gt;= DATEADD(mm, -5 ,DATEADD(m, DATEDIFF(m, 0,GETDATE()), 0)) 
      AND dates &lt;= DATEADD(m, DATEDIFF(m, 0,GETDATE()), 0)    
  </code></pre>
  
  <p>which return data like this:</p>
  
  <p><a href="https://i.stack.imgur.com/sQyIG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sQyIG.jpg" alt="enter image description here"></a></p>
  
  <p>I want a single script which return this output:</p>
  
  <p><a href="https://i.stack.imgur.com/sV4uA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sV4uA.jpg" alt="enter image description here"></a></p>
  
  <p>Basically I am trying to get all the data of second table and no_of_Case from 1st table. The month which is not present in 1st script , for that no_of_case value should be "0".</p>
  
  <p>Please advice !!</p>