title: Divide two records in teradata sql and print one record
body: <p>I need divide two records from a table in sql query
  I have a the next records in a table</p>
  
  <p>Table1</p>
  
  <pre><code>Id    field1  field3
  1     20      20161001  
  1     35      20161101
  2     20      20161001
  2     30      20161101
  5     19      20161001 
  5     33      20161101
  </code></pre>
  
  <p>(Please notice that the dates in  the example are 2016-<strong>OCT</strong>-01 and 2016-<strong>NOV</strong>-01)      </p>
  
  <p>I neeed a sql query that shuld next result:</p>
  
  <pre><code>Id   fieldnew
  1    0.75
  2    0.5
  5    0.7368
  </code></pre>
  
  <p>For calculate the"fieldnew" the rule is:
  Id 1 example</p>
  
  <pre><code>(35 ÷ 20) -1 = 0.75
  </code></pre>
  
  <p>Field1 from field3 with date 20161101 ÷ field1 from field3 with date 20161001 - 1 of record with id 1</p>
  
  <p>Could you help with thw query for obtain the result required please </p>