title: View mismatched entries in a joined table
body: <p>I have tables A, B, and C. B and C are in the same database but a different one from A.</p>
  
  <p>I have a num column and an aid column in A. I have a rn column and a bcid column in B. The bcid column refers to the cid column in C. C also has an asid column.</p>
  
  <p>I want a query such that I get all entries in A where the num and the rn entries match but the aid and asid entries differ.</p>
  
  <p>So far, the best I can do is join tables B and C as such:</p>
  
  <pre><code>SELECT * FROM (B INNER JOIN C ON B.rob = C.cid)
  </code></pre>
  
  <p>I can't seem to alias the above table in my query however. I'd like to do this:</p>
  
  <pre><code>SELECT * FROM A, (SELECT * FROM (B INNER JOIN C ON B.rob = C.cid)) TMP
  WHERE (A.num = TMP.rn AND A.aid &lt;&gt; TMP.asid)
  </code></pre>
  
  <p>But I run into errors. Any guidance in the right direction with this would be greatly appreciated.</p>
  
  <p>EDIT 1:</p>
  
  <p>I'll represent a Table as follows (assuming a table has n columns and m rows:</p>
  
  <pre><code>Name: (col1, col2,..., coln) [(entry1, entry2,... entry n), (entry n+1, entry n+2, ... entry 2n), ..., (entry (m-1)*n, entry (m-1)*n + 1, ..., entry (m*n))]
  </code></pre>
  
  <p>Sample Input:</p>
  
  <pre><code>A : (num, aid) [(1,2), (1,3), (1,4), (1,7)]
  B : (rn, bcid) [(1,1), (1,2), (1,3), (1,4)]
  C : (cid, asid) [(1,3), (2,4), (3,2), (4,6)]
  </code></pre>
  
  <p>Correct Output:
      [(1,7)]</p>
  
  <p>Output I've gotten:
  [(1,2), (1,3), (1,4), (1,7)]</p>
  
  <p>I know why I've gotten the output though: I am assuming that the correspondence between A and the join of B and C are 1-to-1 but they are not.</p>