title: How do you combine an inner and outer join in mysql
body: <p>I can do it in sybase and I can do it in oracle, but I'm not seeing how to do it in mysql.</p>
  
  <p>I've got this:
  (please restrain yourself from re-formatting my sql, last time somebody did that they changed it so it wasn't the same and made the question meaningless)</p>
  
  <pre><code>select table1.id
  from
  table1
    inner join
      table2 on (table1.id = table2.id and table2.data='cat'),
  table1 t1
    left outer join
      table3 on (t1.id = table3.id and table3.data = 'dog')
  </code></pre>
  
  <p>And I get all sorts of results that make no sense.</p>
  
  <p>I want to get a list of all of the id's from table1 where table2.data = cat, then do an outer join with the results of that against table 3 where table3.data = dog.</p>
  
  <p>I notice that I can't specify the same table/alias for table1 in the two join clauses, so that leads me to believe that mysql is running the join expressions separately and ORing the results together or something like that.</p>
  
  <p>I also tried getting rid of the "inner join" in the from section and putting it in the where clause, that didn't work either, though it didn't work in a different way (got different erroneous results)</p>
  
  <p>This would be so easy in sybase or oracle.</p>
  
  <p>What am I doing wrong?</p>