title: Oracle left outer join, only want the null values
body: <p>I'm working on a problem with two tables.  Charge and ChargeHistory.  I want to display a selection of columns from both tables where either the matching row in ChargeHistory has a different value and/or date from Charge or if there is no matching entry in ChargeHistory at all.</p>
  
  <p>I'm using a left outer join declared using the ansi standard and while it does show the rows correctly where there is a difference, it isn't showing the null entries.</p>
  
  <p>I've read that there can sometimes be issues if you are using the WHERE clause as well as the ON clause.  However when I try and put all the conditons in the ON clause the query takes too long > 15 minutes (so long I have just cancelled the runs).  </p>
  
  <p>To make things worse both tables use a three part compound key.</p>
  
  <p>Does anyone have any ideas as to why the null values are being left out?</p>
  
  <pre><code>    SELECT values...
      FROM bcharge charge
      LEFT OUTER JOIN chgHist history
      ON charge.key1 = history.key1 AND charge.key2 = history.key2 AND charge.key3 = history.key3 AND charge.chargeType = history.chargeType
      WHERE charge.chargeType = '2'
        AND (charge.value &lt;&gt; history.value OR charge.date &lt;&gt; history.date)
      ORDER BY key1, key2, key
  </code></pre>