title: Select row of second table only if not exists in first one
body: <p>I have two tables t1 and t2 with the same structure</p>
  
  <pre><code>id INT
  userid INT
  date DATETIME
  </code></pre>
  
  <p>The first table contains my data, while the second table is kind of helper table which contains rows for 10 fix dates and userid = -1
  What i need is a SELECT which gives me all rows from t1 with userid=X joined(merged) with all rows from t2 which date is not already in the result of t1.</p>
  
  <p>Pseudo code</p>
  
  <pre><code>SELECT id, date
  FROM t1, t2
  WHERE (t1.userid=:id OR t2.userid=-1) AND t2.date NOT IN t1.date
  </code></pre>
  
  <p>Sample:</p>
  
  <p>t1:</p>
  
  <pre><code>id    userid     date
  1     1          2015-12-01
  2     1          2015-12-02
  3     1          2015-12-03
  4     2          2015-12-01
  5     2          2015-12-02
  </code></pre>
  
  <p>t2:</p>
  
  <pre><code>id    userid    date
  1     -1        2015-12-01
  2     -1        2015-12-02
  3     -1        2015-12-03
  4     -1        2015-12-04
  5     -1        2015-12-05
  </code></pre>
  
  <p>Expected output for userid=1:</p>
  
  <pre><code>1      1        2015-12-01
  2      1        2015-12-02
  3      1        2015-12-03
  4     -1        2015-12-04
  5     -1        2015-12-05
  </code></pre>
  
  <p>Thanks for your help</p>