pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
To: Andy Lewis <alewis@recruitersonline.com>
Cc: Andrew Perrin - Demography <aperrin@demog.berkeley.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Subtracting from a date
Date: Thu, 13 Apr 2000 15:51:35 +0100
Message-ID: <01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk> (raw)
References: <Pine.LNX.4.20.0004130901110.21309-100000@mail.recruitersonline.com>

> SELECT date_effective FROM your_table WHERE date_effective <= (now() + '3
years ago')

That looks good.
If date_effective is a datetime - should be date_effective::datetime if as
Andrew said date_effective is a date field, I guess.
Also your inequality is the wrong way round for things less than or equal to
3 years old, which is what I thought Andrew wanted.

I think it's a bit faster than the age() construction, too.

----------------------------------------------------------------
Moray.McConnachie@computing-services.oxford.ac.uk




view thread (4+ messages)

Message-ID: <01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk>
Permalink:  ../01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk/
Also on:    postgresql.org/message-id/01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: moray.mcconnachie@computing-services.oxford.ac.uk, alewis@recruitersonline.com, aperrin@demog.berkeley.edu
  Subject: Re: Subtracting from a date
  In-Reply-To: <01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk>
  References: <Pine.LNX.4.20.0004130901110.21309-100000@mail.recruitersonline.com> <01dc01bfa557$c42d1590$760e01a3@oucs.ox.ac.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox