title: Postgres difference between time stamp in minutes
body: <p>I am trying to get time difference in minutes between the event time of below data having the same nodeid and code for nodeid having count > 1</p>
  
  <pre><code>nodeid  code     event_time
  CAI0015 14961045 2017-04-22 21:22:00
  CAI0024 14961045 2017-04-23 19:44:00
  CAI0024 14961045 2017-04-23 09:07:00
  CAI0040 14971047 2017-04-23 13:58:00
  CAI0046 14961045 2017-04-23 11:19:00
  CAI0050 14961045 2017-04-24 02:06:00
  </code></pre>
  
  <p>output should be like this:</p>
  
  <pre><code>nodeid  code     difference(min)
  CAI0024 14961045 637
  </code></pre>