title: I have to find the difference of two consecutive timestamp .But I am getting 'NULL' in "diff" column in the resultset
body: <pre><code>SELECT t1.id AS id1, 
     t2.id AS id2, 
     t1.timestamp AS timestamp1, 
     t2.timestamp AS timestamp2, 
      Timestampdiff(second,t1.timestamp,t2.timestamp)
                              AS diff  
  FROM logs12 AS t1
  JOIN logs12 AS t2 ON (t2.id = t1.id - 1) 
  </code></pre>
  
  <p>
  Data:
  id timestamp
  1  1484407056
  2  1484407536
  3  1484409756
  4  1484410536
  5  1484583336</p>
  
  <p>Expected result
   id   diff
   2   8 min
   3   37 min
   4   13 min
   5   2 days</p>