title: Select from table a where a value from a is on table b mysql
body: <p>Table a:</p>
  
  <pre><code>field1 field2
  x1     x1
  </code></pre>
  
  <p>Table b:</p>
  
  <pre><code>field 1
  x1
  </code></pre>
  
  <p>How would I select on table b where field1 = to field 1 of table a?</p>
  
  <p>What if the name of table b is field1 of table a, what is the syntax to perform the join as the selected table being a.field1</p>
  
  <p>This is the actual query I am using:</p>
  
  <pre><code>mysql_query("SELECT * FROM tags WHERE id3='$value' AND flag!='w' AND visibility='t' JOIN tags.albumid WHERE photoid=tags.photoid AND visibility!='d' ORDER BY datetimep DESC LIMIT 200");
  </code></pre>