Re: [SQL] time intervals

Поиск
Список
Период
Сортировка
От Mark Jewiss
Тема Re: [SQL] time intervals
Дата
Msg-id Pine.BSF.4.05.9904300905520.10443-100000@office.knowledge.com
обсуждение исходный текст
Ответ на time intervals  (JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>)
Список pgsql-sql
> I have two fields, timein & timeout, both defined as type "time".  how can 
> i get the difference between the two??  i am connecting to postgres through 
> access97 and trying to run a simple query to show me timeout, timein, and 
> timeout-timein, but the calculation is returning an error.

In SQL you can do a DATEDIFF...I'm not in front of postgresql so am not
sure if it supports this.

Syntax is

select datediff (day, mydate, 'Jan 10 1999'
from table

If mydate = Jan 9, then the result is one. I think datediff accepts
datetime, so if you specify it properly (i.e. '1 Jan 1999 10:05") then
you'll get the right answers. Just change day to whatever you need.

Regards,

Mark.
--
Mark Jewiss
Knowledge Matters Limited



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

Предыдущее
От: Christophe Labouisse
Дата:
Сообщение: [SQL] Index on date_trunc
Следующее
От: George Moga
Дата:
Сообщение: Re: [SQL] time intervals