title: How to join two tables if they are in different schemas
body: <p>I have two different schemas in SQL Server (say S1, S2). And two tables in those schemas(say S1.Table1, S2.Table2). I want to query these two tables from schema S1.</p>
  
  <p>Both S1 and S2 are in SQL Server 2005 databases. I want to do something like this:</p>
  
  <pre><code>select T1.Id
    from S1.Table1 T1
       , S2.Table2 T2 
   Where T1.Id = T2.refId
  </code></pre>