title: MySQL Select Left Join multiple columns from the same table
body: <p>I have objects in the Main Project Workflow table that I need to relate to one object in the User table. The issue I am facing is when I do a LEFT JOIN, I can only relate one object at a time.<br></p>
  
  <p><strong>The relation I need to do is:</strong></p>
  
  <pre><code>workflowUID = user_id
  assignedTo   = user_id
  </code></pre>
  
  <p>I believe the problem is being caused by my <code>LEFT JOIN</code>, however, I don't know which join statement I need to use to do this relation.</p>
  
  <p><strong>User Table</strong></p>
  
  <pre>
  user_id | user_firstName | user_lastName
  1       | Joe            | Smith
  2       | John           | Doe
  </pre>
  
  <p><strong>Main Project Table</strong></p>
  
  <pre>
  projectID | projectTitle | projectDesc   | projectDueDate | projectAssignedTo
  1         | Test Title   | Desc for Proj | 11-06-2018     | 2
  </pre>
  
  <p><strong>Main Project Workflow Table EDITED</strong></p>
  
  <pre>
  projectID | CID | workflowUID | assignedTo
  1         | 1   | 1           | 2
  </pre>
  
  <p>The projectID is releated to another table called mainProjects, which list more info about the project such as the project title, created/due date, created by, effort in hours, project description.</p>
  
  <p>The CID is stored in the Main Project Workflow Table. It is the Commit ID. Which will be used later for stuff like editing/deleting comments. </p>
  
  <p><strong>Output</strong></p>
  
  <pre>
  Workflow Created By | Workflow Assigned To
  Joe Smith           | John Doe
  </pre>
  
  <p><strong>SQL:</strong> </p>
  
  <pre><code>SELECT *
  FROM mainprojectworkflow 
  LEFT JOIN user ON mainprojectworkflow.workflowUID = user.user_id
  WHERE projectID = $projectID
  ORDER BY cid DESC
  </code></pre>
  
  <p>The second I try setting a second LEFT JOIN user ON mainprojectworkflow.workflowUID = user.user_id but instead, as a mainprojectworkflow.assignedTo I get a not unique table/alias user. I believe this is because I am already setting the user table to mainprojectworkflow.</p>
  
  <p><strong>EDIT</strong>
  I'm sorry, I should have been more clear on what's going on. <br></p>
  
  <p><strong>END RESULT:</strong> My plan is to use the SQL to select the data and display it in PHP on a website. It's a project management website. I want to be able to have PHP pull the variables from SQL so I can use them however I feel fit. </p>