Re: [GENERAL] datetime problems

Поиск
Список
Период
Сортировка
От Memphisto
Тема Re: [GENERAL] datetime problems
Дата
Msg-id Pine.GSO.3.96.981021173942.29288D-100000@valerie.inf.elte.hu
обсуждение исходный текст
Ответ на Re: [GENERAL] datetime problems  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Ответы Re: [GENERAL] datetime problems  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Список pgsql-general
> Probably because the parentheses are not balanced in the first query. But
> why the subqueries, anyway? Why not simply:
>
> SELECT * FROM annex_log
> WHERE login_start
>     BETWEEN date_trunc('month','now'::datetime)
>         AND ( date_trunc('month','now'::datetime) + '1 month'::timespan);
>
> (Note that I also removed the redundant type conversion you did on '1 month').
Noted, thanks. I'm a newbie in postgreSQL and happy that these types and
functions exist, but I think the documentation is a bit spartan(lacks a
lot of pieces of information) and depend on those bits that are there in
the documentation.

>
> Again, I recommend doing the >=, < thing rather than 'between', because
> 'between' will also allow the actual value of 1998-09-01 (for example) to
> be included. It's a close interval, rather than a half-open one.
That's right, I didn't know about the behaviour of 'between'. I'm going
to use '>=' and '<'.

Another question. Is there way to these truncation to weeks instead of
months. As far as I know, postgreSQL does not support it.

--------------------------------------------------------------------------------
Sebestyén Zoltán AKA Memphisto        It all seems so stupid,
                    it makes me want to give up.
szoli@neumann.cs.elte.hu        But why should I give up,
                                        when it all seems so stupid?

MAKE INSTALL NOT WAR            And please avoid Necrosoft Widows



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

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [GENERAL] datetime problems
Следующее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [GENERAL] questions