pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas <maps.on@gmx.net>
To: pgsql-sql@postgresql.org
Subject: how to calculate differences of timestamps?
Date: Tue, 27 Sep 2011 03:31:51 +0200
Message-ID: <4E812787.1080002@gmx.net> (raw)

How could I calculate differences of timestamps in a log-table?

Table log ( user_id integer, login boolean, ts timestamp )

So login = true would be a login-event and login = false a logout.
Is there a way to find the matching login/logout to calculate the 
difference?

Or is there a better table "design" to do this?



view thread (3+ messages)  latest in thread

Message-ID: <4E812787.1080002@gmx.net>
Permalink:  ../4E812787.1080002@gmx.net/
Also on:    postgresql.org/message-id/4E812787.1080002@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: maps.on@gmx.net
  Subject: Re: how to calculate differences of timestamps?
  In-Reply-To: <4E812787.1080002@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox