Re: using dates in pgsql

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: using dates in pgsql
Date: 2003-08-28 09:06:03
Message-ID: 1062061562.25752.170.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 2003-08-27 at 23:28, Tom Lane wrote:
> JohnH <JohnH(at)atkgib(dot)com(dot)au> writes:
> > But I want to use a variable in the WHERE option
> > WHERE activedate < (current date less 188 days)
>
> You're going to be embarrassed...
>
> WHERE activedate < (CURRENT_DATE - 188)

How does pg know that that's 188 days, and not months or years?

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron(dot)l(dot)johnson(at)cox(dot)net
Jefferson, LA USA

"You ask us the same question every day, and we give you the
same answer every day. Someday, we hope that you will believe us..."
U.S. Secretary of Defense Donald Rumsfeld, to a reporter

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stuart Woodward 2003-08-28 10:10:09 From which version was DROP ... CASCADE supported?
Previous Message Tom Lane 2003-08-28 04:28:40 Re: using dates in pgsql