title: Sequelize 'where' on parent and child tables
body: <p>I need to make a query in two tables (parent and child), through sequelize (with mysql).</p>
  
  <p>The problem it's that when i use where clause on parent table it discards results on child's table.</p>
  
  <p>In SQL Words i need something like</p>
  
  <pre><code>SELECT * 
  FROM PARENT 
  INNER JOIN CHILD 
    ON PARENT.ID = CHILD.PARENTID 
  WHERE PARENT.FIELD LIKE 'A' 
    OR CHILD.FIELD LIKE 'A'
  </code></pre>
  
  <p>Instead, sequelize always returns something like</p>
  
  <pre><code>SELECT * 
  FROM PARENT 
  INNER JOIN CHILD 
    ON PARENT.ID = CHILD.PARENTID 
   AND (CHILD.deletedAt IS NULL AND (CHILD.FIELD LIKE 'A')) 
  WHERE (PARENT.deletedAt IS NULL AND (PARENT.FIELD LIKE 'A'))
  </code></pre>
  
  <p>I have checked the data and the child query brings results but because of the where statement in the parent query it discards child results</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My code is something like:</p>
  
  <pre><code>var childTable = {model:child.model,where.$or:{childField:{$like:'A'}}};
  queryOptions = {};
  queryOptions.include = [chilldTable];
  queryOptions.where = {$or:{parentField:{$like:'A'}}}
  Parent.findAll(queryOptions).then(res.send.bind(res))
    .catch(errorHandler(res, next));
  </code></pre>
  
  <p>Does anybody now why this it's happening?</p>
  
  <p>Thanks!</p>