Re: work hour calculations

From: novice <user(dot)postgresql(at)gmail(dot)com>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: work hour calculations
Date: 2007-09-09 01:06:49
Message-ID: ddcb1c340709081806r6cbc6b75vf71e6cfe2f454129@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On 07/09/2007, Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com> wrote:
> 2007/9/5, Raj A <raj(dot)ayappan(at)gmail(dot)com>:
> > correction:
> >
> > > The result I'm expecting for the above to be
> > >
> > > notification_time | finished_time | actual
> > > ------------------------+------------------------+-----------------
> > > 2007-07-06 15:50:00+10 | 2007-07-09 07:10:00+10 | 01:20:00
> > > 2007-07-07 12:30:00+10 | 2007-07-09 07:20:00+10 | 00:20:00
>
> Could you please show the data structures ( create table commmands +
> ane constraints you have )?
>
> If you do this, you have much bigger chance of getting an answer :)

sure

create table log
(
id integer PRIMARY KEY,
notification_time timestamp with time zone,
finished_time timestamp with time zone
);

INSERT INTO log values (1, '2007-07-06 15:50', '2007-07-09 07:10');
INSERT INTO log values (2, '2007-07-07 12:30', '2007-07-09 07:20');

SELECT notification_time, finished_time, sum(finished_time -
notification_time) as actual
FROM log
GROUP BY notification_time, finished_time;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Trevor Talbot 2007-09-09 02:17:36 Re: Scalability Design Questions
Previous Message novnov 2007-09-09 00:58:06 Re: Scalability Design Questions

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2007-09-09 11:01:52 Re: work hour calculations
Previous Message A. Kretschmer 2007-09-07 17:41:00 Re: to_date function