title: How to Use sql FULL OUTER JOIN query in VBA Excel
body: <p>I would like to use <strong>FULL OUTER JOIN</strong> sql query via VBA excel.Below is my code and tables. Please guide how can i use the same.</p>
  
  <p><strong>1st Table-</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ahfXx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ahfXx.png" alt="enter image description here"></a></p>
  
  <p><strong>2nd Table-</strong></p>
  
  <p><a href="https://i.stack.imgur.com/iPWXs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iPWXs.png" alt="enter image description here"></a></p>
  
  <p><strong>VBA Code:-</strong></p>
  
  <pre><code>Sub SQL()
  
  Dim cn As ADODB.Connection
  Dim rs As ADODB.Recordset
  
  strFile = ThisWorkbook.FullName
  strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &amp; strFile _
  &amp; ";Extended Properties=""Excel 12.0;HDR=Yes;IMEX=1"";"
  
  Set cn = CreateObject("ADODB.Connection")
  Set rs = CreateObject("ADODB.Recordset")
  
  cn.Open strCon
  
  strSQL = "SELECT * FROM [Sheet3$] FULL OUTER JOIN [Sheet2$] ON [Sheet2$].[Sr]=[Sheet3$].[Sr]"
  rs.Open strSQL, cn
  
  Sheet5.Range("D1").CopyFromRecordset rs
  
  End Sub
  </code></pre>
  
  <p>In my above code i am getting below error.</p>
  
  <p><a href="https://i.stack.imgur.com/rVnQU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rVnQU.png" alt="enter image description here"></a></p>