Re: Help With date/time

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Help With date/time
Дата
Msg-id 20031108172854.GA22452@wolff.to
обсуждение исходный текст
Ответ на Help With date/time  (Alex <alex@meerkatsoft.com>)
Список pgsql-general
On Sun, Nov 09, 2003 at 02:04:22 +0900,
  Alex <alex@meerkatsoft.com> wrote:
> Hi,
> I want to remove data that is older that a certain number of months..
> only full months.

One approach would be to get the year, month and day as numbers from
the current date. Then change the day to 1 and subtract 3 from the
month (borrowing 1 from the year if necessary) and then use these
numbers to build the date you want to test against.

>
> example: today is 11-08 and I want do delete all data that is older than
> this month - 3 month i.e. i want to delete all information that is older
> than Aug. 1st.
>
> Is there an easy way to do that ? Interval cannot be used and I cannot
> just pass something like now()::date < '2003-08'
>
> Thanks for any help here
> Alex
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

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

Предыдущее
От: Alex
Дата:
Сообщение: Help With date/time
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: int8 primary keys still not using index without manual