Yearly date comparison?

Поиск
Список
Период
Сортировка
От Nick
Тема Yearly date comparison?
Дата
Msg-id a48f5b10-216e-4508-bfa6-2a1e4734d3a9@p13g2000yqd.googlegroups.com
обсуждение исходный текст
Ответы Re: Yearly date comparison?
Re: Yearly date comparison?
Список pgsql-general
What is the best way to find an event with a yearly occurrence?

CREATE TABLE events (
    start_date DATE,
    end_date DATE,
    recurring TEXT
);
INSERT INTO events (start_date, end_date, recurring) VALUES
('2010-02-28','2010-03-01','yearly');

SELECT * FROM events WHERE (start_date+'2 YEARS'::INTERVAL) >= NOW()
AND (end_date+'2 YEARS'::INTERVAL) < NOW();

Since I may not know how many years back the start/end_date is, is
there a way to just ignore the year or make it the current year,
without killing performance?

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: what Linux to run
Следующее
От: Durumdara
Дата:
Сообщение: Re: Correct way for locking a row for long time without blocking another transactions (=nowait)?