Re: DATE field subtraction - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: DATE field subtraction
Date
Msg-id 20020819213835.B23300@svana.org
Whole thread Raw
In response to DATE field subtraction  (Ralph Graulich <maillist@shauny.de>)
List pgsql-general
On Mon, Aug 19, 2002 at 12:33:34PM +0200, Ralph Graulich wrote:
> Hi,
>
>
> I assume I am just to blind to find it in the documentation: I have a DATE
> field and want to subtract 4 weeks.
>
> SELECT [...]
> FROM table
> WHERE datefield >= '2002-08-19' - interval '4 weeks'

I'd do:

SELECT [...]
FROM table
WHERE datefield >= '2002-08-19'::date - 28;

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

pgsql-general by date:

Previous
From: "Peter Gibbs"
Date:
Subject: Re: DATE field subtraction
Next
From: Tom Lane
Date:
Subject: Re: Success: Finished porting application to postgreSQL