title: how to calculate time difference between two dates? - MySql
body: <pre><code>code    id                  date               time difference   
  AiK4JJ  kcy2000ok   2012-01-31 17:25:41         13    
  unBG1D  gktoql      2012-01-31 17:25:35          3    
  vzqeWU  gktoql      2012-01-31 17:25:32          4    
  vvkOSd  judyssi     2012-01-31 17:25:32          8    
  uwhbGt  kcy2000ok   2012-01-31 17:25:28 ?    
  unBG1D  gktoql      2012-01-31 17:25:27         ?    
  vvkOSd  judyssi     2012-01-31 17:25:24         ?
  </code></pre>
  
  <p>I want to calculate the time difference in seconds between recent date and previous date based on id.</p>
  
  <p>If you look at kcy2000ok, time difference is 13 seconds for last row.</p>
  
  <p>time difference for gktoql is 3 seconds for last row.</p>
  
  <p>I need to make a query that calculate time difference based on id.</p>
  
  <p>Can you help me to build MySql query?</p>