Re: [GENERAL] work hour calculations

Поиск
Список
Период
Сортировка
От novice
Тема Re: [GENERAL] work hour calculations
Дата
Msg-id ddcb1c340709081806r6cbc6b75vf71e6cfe2f454129@mail.gmail.com
обсуждение исходный текст
Ответ на work hour calculations  (novice <user.postgresql@gmail.com>)
Список pgsql-sql
On 07/09/2007, Filip Rembiałkowski <plk.zuber@gmail.com> wrote:
> 2007/9/5, Raj A <raj.ayappan@gmail.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;

В списке pgsql-sql по дате отправления:

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: to_date function
Следующее
От: "Fernando Hevia"
Дата:
Сообщение: Function Volatility