title: Connect to more than one SQL server database from R in a single sqlQuery
body: <p>I'm working with R Studio. I want to use sqlQuery() to join 2 tables in sql server. The tables are in separate databases. How would i go about connecting to them both in a single sqlQuery()</p>
  
  <p>For example if the two database are 'DB1' and 'DB2' the following code connects to DB1 only:</p>
  
  <pre><code>sqlcon &lt;- odbcDriverConnect('driver={SQL Server};server=blah;schema=dbo;
  database=DB1;trusted_connection=true')
  
  sqlQuery(sqlcon, "my sql code for joining the tables")
  </code></pre>
  
  <p>How could i write it so 'sqlcon' is connecting to both databases at the same time?</p>
  
  <p>I know i can import the sql tables separately into R and join them with R code but wanted to know if it could be done all within a single sqlQuery()</p>