Re: [SQL] Problem with datetime

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Problem with datetime
Дата
Msg-id 1895.941204695@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problem with datetime  (Holm Tiffe <holm@freibergnet.de>)
Список pgsql-sql
Holm Tiffe <holm@freibergnet.de> writes:
> But now both days at on time:

> SELECT sum(stop-start) FROM logs WHERE name = 'intern-mw' and
start> = '27-10-1999' AND stop < ('28-10-1999'::datetime + '1 day'::timespan);
> sum                      
> -------------------------
> @ 12 hours 51 mins 4 secs
> (1 row)

>  uups what's happening here ?

> I've doublechecked the WHERE clause, It is ok, the right tuples are selected,
> but 3h + 4.5h are not 13h! Wat I'm doing wrong here ?

Maybe I'm missing something obvious, but it seems to me that the above
command will include log entries that cross the midnight boundary
between the two dates, whereas neither of the other two do.  Seems like
you must have about 5.5h worth of such entries...
        regards, tom lane


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

Предыдущее
От: "Imtiaz. S. M"
Дата:
Сообщение: Re :Setting default row value after select into table
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: [SQL] trivial problem