title: sql query that involves OR won't return results if one of the tables empty
body: <p>I have a problem figuring out a small problem with this query to mysql db</p>
  
  <pre><code>SELECT s.*
  FROM section AS s, sectioncompany AS scom
  WHERE ((s.restricted = 0 ) OR (s.restricted = 1 AND s.id = scom.sectionId AND scom.companyId = $companyId))
  </code></pre>
  
  <p>This works fine and returns results when there are entries in sectioncompany table, but when that table is empty, query won't result anything. At the moment I did a workaround by simply adding an empty record to sectioncompany table but I want to understand what have I overlooked. As you can see, the condition that involves existing values in that table wouldn't be met once table is empty, but it should still return something for s.restricted = 0, shouldn't it? What am I missing?</p>
  
  <p>Thanks</p>