title: SQL Query - Year by Year Growth of Sales
body: <p>I have this result set from an SQL query. This result has come up by grouping the sales of tenant per year to get the total sales in yearly basis. Table is named TENANTSALES with columns: Tenant, date, sales etc.</p>
  
  <pre><code>TENANT      YEAR    SALES   
  tenant 1    2014    2000    
  tenant 1    2015    5000       
  tenant 2    2013    1000    
  tenant 2    2014    1500       
  tenant 2    2015    800    
  </code></pre>
  
  <p>I used this SQL query code to achieve the above result</p>
  
  <pre><code>select tenant, year(date), SUM(sales)
  from tenantSales
  group by tenant, YEAR(date)
  </code></pre>
  
  <p>What I need to complete the task is to add a column name Yearly growth where it will compare and compute for year by year growth of sales per tenant. Here's the sample correct / desired output</p>
  
  <pre><code>TENANT      YEAR    SALES    YEARLY GROWTH
  tenant 1    2014    2000    
  tenant 1    2015    5000       150%
  tenant 2    2013    1000    
  tenant 2    2014    1500       50%
  tenant 2    2015    800       -46.67%
  </code></pre>
  
  <p>The formula is: ((Latest Year - Previous Year) / Previous Year) * 100</p>
  
  <p>Example for Tenant 1:</p>
  
  <p>((2015 sales - 2014 sales) / 2014 sales) * 100 = 150%</p>
  
  <p>Ive tried to do this, adding the next year in the previous year's row to make it easy for me to compute for the two years sales, but I can't add up the sales of the latest year, only the year itself. Is there any way or proper way to do it? </p>
  
  <pre><code>select tenantcode, year(date), SUM(gsc), year(date) + 1
  from dailymod
  where tenantcode = 'cmbina13'
  group by tenantcode, YEAR(date)
  </code></pre>
  
  <p>Your expert advice will be highly appreciated. Thanks</p>