title: How do I build a SQL query to show two columns of different date ranges?
body: <p>I'm trying to build a query from an Oracle 11g database to use in a report. I need to use two tables CONTACT and CONTACT_EXT to get the data from, and compare the total amount of contacts over two date ranges.The tables are joined by ID's matching.</p>
  
  <p>CONTACT:</p>
  
  <pre><code>ID | DATE
  ----------
  1   12/12/2010
  2   12/11/2010
  3   14/09/2011
  </code></pre>
  
  <p>CONTACT_EXT</p>
  
  <pre><code> ID | TYPE
  ----------
  1   MAIL
  2   FAX
  3   FAX  
  </code></pre>
  
  <p>So for example if I set period A to be between 01/01/2010 and 12/12/2010 and period B to be between 01/01/2011 and 11/11/2011</p>
  
  <pre><code>TYPE | PERIOD A | PERIOD B | TOTAL
  MAIL   1          0          1
  FAX    1          1          2
  </code></pre>