Re: [GENERAL] Selecting between dates

From: Aaron Seigo <aaron(at)gtv(dot)ca>
To: wim(at)netmaster(dot)ca
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Selecting between dates
Date: 1999-08-10 21:53:18
Message-ID: 3.0.6.32.19990810155318.00799c90@gtv.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi wim..

>select * from company where created
>is between (lastpaid + 14 days) and (created + 28 days);

assuming that lastpaid and created are dates, pgsql will handle the
addition quite nicely for you... as examples:

test=> select '4-1-1999'::date + 7;
?column?
----------
04-08-1999
(1 row)

test=> select '4-26-1999'::date + 7;
?column?
----------
05-03-1999

test=> select '12-26-1999'::date + 7;
?column?
----------
01-02-2000
(1 row)

Aaron J. Seigo
Systems Analyst/Administrator

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 1999-08-10 23:02:33 Re: [GENERAL] anomalous, persistent high loads with postgresql 6.5.1
Previous Message Bill Garrett 1999-08-10 21:39:18 anomalous, persistent high loads with postgresql 6.5.1