title: SQL inner join two tables with the same column names
body: <p>I have two tables with a variable amount of columns. (I don't know how many columns or what there names will be) for example Table A and Table B. </p>
  
  <p>TableA: </p>
  
  <pre><code>ID | B_ID | {variable} 
  </code></pre>
  
  <p>TableB</p>
  
  <pre><code>ID | {variable} 
  </code></pre>
  
  <p>Query: </p>
  
  <pre><code>SELECT TableA.*, TableB.* FROM TableA INNER JOIN TableB ON TableA.B_ID= TableB.id;
  </code></pre>
  
  <p>When TableA and TableB both have a column with a same name I can't distinguish between the two different columns. For example of both tables has the column "Name" this query would result in :</p>
  
  <pre><code>ID | ID | B_ID | NAME | NAME |
   1 | 35 | 35   | bob  | jim  |
  </code></pre>
  
  <p>What I am looking for is a way to differentiate between the two tables. Preferably with a prefex for the column names such as. </p>
  
  <pre><code>TableA_ID | TableB_ID | TableA_B_ID | TableA_NAME | TableB_NAME |
          1 |        35 |          35 |         bob |         jim |
  </code></pre>
  
  <p>I know of the "AS" keyword but the problem is that I don't know what the column names are going to be before hand. (I don't know if TableA or TableB are going to have the column Name)</p>
  
  <p>So my question is </p>
  
  <p>How do you differentiate the columns between the two tables with a INNER JOIN when the tables may have the same column names ?</p>
  
  <p>I am using SQLite3. </p>