Re: Query Casting Help

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Query Casting Help
Дата
Msg-id 200207091152.29695.dev@archonet.com
обсуждение исходный текст
Ответ на Query Casting Help  (Hunter Hillegas <lists@lastonepicked.com>)
Список pgsql-general
On Tuesday 09 Jul 2002 12:21 am, Hunter Hillegas wrote:
> I am trying to execute this little bit:
>
> (extract(month from current_date) + interval '1 month')
>
> The system says I need to cast because it can't figure out how to add
> these... I read through the manual and I am still a little confused.

Try:

 select extract(month from (current_date + interval '1 month'));
 date_part
-----------
         8

You want to add an interval to a date. It probably doesn't make sense to add
an interval to a month.

Alternatively:

select extract(month from (current_date)) + 1;

But that wouldn't deal with wrap-around in December.

- Richard Huxton



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

Предыдущее
От: "frank_lupo"
Дата:
Сообщение: problem GMT time
Следующее
От: Manfred Koizar
Дата:
Сообщение: Re: Query Analyzing