work hour calculations

Поиск
Список
Период
Сортировка
От novice
Тема work hour calculations
Дата
Msg-id ddcb1c340709042045lbe5d58fode7497c8eb060c97@mail.gmail.com
обсуждение исходный текст
Ответы Re: work hour calculations  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-sql
Hello All,

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

gives me:

   notification_time    |     finished_time      |     actual
------------------------+------------------------+-----------------
 2007-07-06 15:50:00+10 | 2007-07-09 07:10:00+10 | 2 days 15:20:00
 2007-07-07 12:30:00+10 | 2007-07-09 07:20:00+10 | 1 day 18:50:00


How can write a query to calculate the duration using custom work
hours which is Monday 7am /  Friday 5pm?

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 | 00:20:00
 2007-07-07 12:30:00+10 | 2007-07-09 07:20:00+10 | 00:20:00

Thanks.

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

Предыдущее
От: Richard Ray
Дата:
Сообщение: Re: How to influence the planner
Следующее
От: novice
Дата:
Сообщение: Re: work hour calculations