title: SQL query to get current and last year sales
body: <p>I have the following table Sales:</p>
  
  <pre><code>Date        Store   Sales
  1/1/2015    St01    12123
  1/1/2015    St02    3123
  1/1/2016    St01    4213
  1/1/2016    St03    2134
  </code></pre>
  
  <p>When I try to self join to get this year and last year sales the closed store is not showing up.
  The result should be like this: </p>
  
  <pre><code>Date        Store   This year Sales   Last Year Sales
  1/1/2016    St01    4213              1212
  1/1/2016    St02    0                 3123
  1/1/2016    St03    2134              0
  </code></pre>
  
  <p>My query as follows:</p>
  
  <pre><code>SELECT CY.DATE, 
         CY.store cy.Sales, 
         LY.sales 
  FROM   sales CY, 
         sales LY 
  WHERE  CY.store(+) = LY.store(+) 
         AND LY.DATE = CY.DATE - 365 
  </code></pre>