title: How can I avoiding Cartesian product on SQL on multiple tables
body: <p>Here is my sqlfiddle <a href="http://sqlfiddle.com/#!3/671c8/1" rel="nofollow">http://sqlfiddle.com/#!3/671c8/1</a>. </p>
  
  <p>Here are my tables:</p>
  
  <p>Person</p>
  
  <p><code>PID    LNAME   FNAME
  1       Bob     Joe
  2       Smith   John
  3       Johnson Jake
  4       Doe     Jane
  </code></p>
  
  <p>Table1</p>
  
  <p><code>PID    VALUE
  1       3
  1       5
  1       35
  2       10
  2       15
  3       8
  </code></p>
  
  <p>Table2</p>
  
  <p><code>PID    VALUE
  1       X1
  1       X2
  1       X3
  2       Z1
  3       X3
  </code></p>
  
  <p>I am trying to join several tables on a person's ID. These tables contain events with dates, but the dates may or may not match across table. So what I really want it to regardless of date join the tables in a way such that when I get results the table with the largest rows will be the amount of rows in my result and all other tables will "fit" within. For example</p>
  
  <p>Instead of this which is a cartesian product:</p>
  
  <pre><code>PID     LNAME   FNAME   THINGONE    THINGTWO
  1       Bob     Joe     3           X1
  1       Bob     Joe     3           X2
  1       Bob     Joe     3           X3
  1       Bob     Joe     5           X1
  1       Bob     Joe     5           X2
  1       Bob     Joe     5           X3
  1       Bob     Joe     35          X1
  1       Bob     Joe     35          X2
  1       Bob     Joe     35          X3
  </code></pre>
  
  <p>I would like something like this:</p>
  
  <pre><code>PID     LNAME   FNAME   THINGONE    THINGTWO
  1       Bob     Joe     3           X1
  1       Bob     Joe     5           X2
  1       Bob     Joe     35          X3
  </code></pre>
  
  <p>My sql statement:</p>
  
  <pre><code>SELECT
      p.*,
      t1.value as thingone,
      t2.value as thingtwo
  FROM
      person p 
      left outer join table1 t1 on p.pid=t1.pid
      left outer join table2 t2 on p.pid=t2.pid
  ;
  </code></pre>