title: 3 Tables, 2 Databases, 1 Server... How to Join? (SQL/Informix)
body: <p>I need to formulate a single query to do the following:
  1) Join two (informix) SQL tables on the same server(already done/working)
  2) Join a third SQL table on the same server, but in a different database.</p>
  
  <p>For my example code, let's use tableA and tableB on databaseA, and tableC on databaseB.</p>
  
  <p>Joining the two tables on the same database is no problem.</p>
  
  <pre><code>SELECT tableA.columnA
         tableB.columnA
  FROM
         tableA
  JOIN
         tableB
  ON
         tableB.columnSHARED = tableA.columnSHARED
  WHERE
         ([where clauses are inconsequential for this])
  </code></pre>
  
  <p>Now, what I can't seem to get working is a second JOIN clause for tableC on databaseB.  I have tried prefixing all table/column references with database name prefixes, but this doesn't seem to work.</p>
  
  <p>Just to clarify, both databases are on the same server and the user running these commands has access to both databases.  I would provide an error message, but there isn't really anything useful coming back from Informix besides the fact that there is an error on line X near character position Y (the third join clause).  There is also a common link:</p>
  
  <pre><code>databaseB.tableC.columnSHARED
  </code></pre>
  
  <p>How would/can I join <code>databaseB.tableC</code> to <code>databaseA.tableA</code> and <code>databaseA.tableB</code>?</p>
  
  <hr>
  
  <p>EDIT 2:  New Sanitized Query for responder:</p>
  
  <pre><code>SELECT FIRST 100 
      tableA.sharedColumn, 
      tableA.colA, 
      tableA.colB, 
      tableA.colC, 
      tableA.colD, 
      tableA.colE, 
      tableA.colF, 
      tableA.colG, 
      tableB.colA ,
      databaseB:tableC.column
  FROM 
      tableA 
  JOIN 
      tableB 
  ON 
      tableB.sharedColumn = tableA.sharedColumn 
  LEFT OUTER JOIN 
      databaseB:tableC 
  ON 
      databaseB:tableC.sharedColumn = databaseA:tableA.sharedColumn 
  WHERE 
      {where clauses}
  </code></pre>