title: Optimizing JOIN with UNION is not working
body: <p>I have a query :</p>
  
  <pre><code>SELECT * FROM foo f1
  JOIN foo f2 ON f1.ID = f2.ParentID or f1.ID = f2.ChildID
  AND f2.CreateTime &gt; 'YYYY-MM-DD 00:00:00.000'
  </code></pre>
  
  <p>I tried to optimize it to get better performance so I wrote :</p>
  
  <pre><code>SELECT * FROM foo f1
  JOIN foo f2 ON f1.ID = f2.ParentID
  AND f2.CreateTime &gt; 'YYYY-MM-DD 00:00:00.000'
  
  UNION
  
  SELECT * FROM foo f1
  JOIN foo f2 ON f1.ID = f2.ChildID
  AND f2.CreateTime &gt; 'YYYY-MM-DD 00:00:00.000'
  </code></pre>
  
  <p>But I am getting different results! Any idea why?</p>
  
  <p>Thank you!</p>