12 Mar 2010

Zapytanie do bazy z wykorzystaniem funkcji NOW()

SELECT * FROM TABLE WHERE t_add_date < NOW()-'5 MONTH'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()+'5 MONTH'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()-'1 DAY'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()-'2 DAYS'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()-'1 DAY'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()-'5 MINUTES'::INTERVAL
SELECT * FROM TABLE WHERE t_add_date < NOW()-'3 HOURS'::INTERVAL