title: Postgres SQL Joins for Many To Many Relationship
body: <p>right now I am "learning" Postgres SQL. I have 3 tables:</p>
  
  <p>1) User: userId</p>
  
  <p>2) Stack :stackId</p>
  
  <p>3) User_Stack: userId, stackId</p>
  
  <p>Now I want to fetch all stacks belonging to one user, given the userId. I understand I need to use Joins, but thats were I get stuck... I try it like this:</p>
  
  <pre><code>SELECT * FROM "Stack" LEFT OUTER JOIN "User_Stack" ON ('User_Stack.stackId' = 'Stack.stackId') WHERE "userId" = '590855';
  </code></pre>
  
  <p>Error: The returned data is empty.</p>
  
  <p>PS: Is there any GUI Query builder out there ? Or do you have any other tips how to systematically create queries ?</p>
  
  <p>EDIT: If I change the query to this:</p>
  
  <pre><code>SELECT * FROM "Stack" INNER JOIN "User_Stack" ON (User_Stack.stackId = Stack.stackId) WHERE "userId" = '590855';
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>  Kernel error: ERROR:  missing FROM-clause entry for table "user_stack"
    LINE 1: SELECT * FROM "Stack" INNER JOIN "User_Stack" ON (User_Stack...
  </code></pre>