title: mysql JOIN has me beat
body: <p>From the outset let me say that I really struggle with joins.</p>
  
  <p>I have a table called 'registervendors'. In the table is a column called 'state'. 'state' is a single digit number. I also have a column called 'vendregid'.</p>
  
  <p>I have another table called 'states'. In that table is a column called 'state'. 'state' in this  table is a three letter abbreviation and another called 'statesid' which is a single digit number.  </p>
  
  <p>I need all this to happen WHERE  'vendregid' is matched.  </p>
  
  <p>So I think it would go something like this:</p>
  
  <pre><code>    $rows = $db-&gt;select(" SELECT * FROM registervendors r  JOIN states s ON  s.state = r.state WHERE regid='$vendregid' "); 
  </code></pre>
  
  <p>if regid is a match I want to pull from table 'states' the abbreviation in column 'state' where table 'statesid' matches 'registorvendors' column 'state' 
  Its doing my head in.</p>