title: MySQL / PHP: Use inner join if value isn't 0
body: <p>I want to use a select query which gets data from tables.</p>
  
  <p>It looks like this</p>
  
  <pre><code>SELECT table1.value1, table1.value2, table1.id, table2.id, table2.value2
  FROM table1
  INNER JOIN table2
  ON table2.id = table1.value4
  ORDER BY table1.id DESC
  LIMIT 10
  </code></pre>
  
  <p>Though <code>table1.value4</code> can sometimes be 0 and there are no <code>table2.id</code> with the value 0 and since it's a auto-increment value, it starts at 1. And I want it to start at 1.</p>
  
  <p>Because when it's equal to 0 then that specific row isn't available, just the other ones.</p>
  
  <p>But I would like to some how set a where clause that it only should get the <code>table2</code> values if <code>table1.value4</code> isn't equal to 0.</p>