title: How to do a JOIN from two different columns to the same column on a separate table
body: <p>I have two columns on one table that reference the same column on a second table in order to obtain the name that relates to an specified ID.</p>
  
  <p>Below is the query that I am using that is not working.  The two LEFT JOINS on the invTypes causes the problem.  I have read and read and have been racking my brain on this.  I cannot for the life of me figure out how to make this return the names that belong to the IDs that appear in two separate locations in the main table.</p>
  
  <p>THings to note with out posting the entire database structure (which is huge)</p>
  
  <p>both the <code>typeID</code> and <code>itemTypeID</code> are present on the main table.  Each of those references the same <code>typeID</code> column in the <code>invTypes</code>  table.  The <code>invTypes</code> table contains the name that corresponds to said ID. </p>
  
  <p>Additionally, in the SELECT part of the statement, the <code>typeName</code> comes from the <code>invTypes</code> and the <code>stationName</code> comes from the <code>staStations</code> table.  </p>
  
  <p>The main question is, if the invTypes.<code>typeName</code> is referenced two times from two columns, how do i 1: properly join the tables to those two points and 2: how do i tell the difference in the two invTypes.<code>typeName</code> that is to be returned if the two JOIN statements can be made.</p>
  
  <pre><code>SELECT 
  `logTime`,`itemID`,`typeName`,`actorName`,`stationName`,`action`,`passwordType`,
  `quantity`,`oldConfiguration`,`newConfiguration` 
          FROM eve_container_audit 
          LEFT JOIN invTypes ON eve_container_audit.typeID = invTypes.typeID
          LEFT JOIN invTypes ON eve_container_audit.itemTypeID = invTypes.typeID
  
          LEFT JOIN staStations ON eve_container_audit.locationID = staStations.stationID
  </code></pre>