From: | "Jose' Soares" <jose(at)sferacarta(dot)com> |
---|---|
To: | Kevin Heflin <kheflin(at)shreve(dot)net> |
Cc: | "PGSQL-General (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] select using date |
Date: | 1999-01-08 12:37:57 |
Message-ID: | 3695FC25.42E4EB53@sferacarta.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Try:
select current_date, CURRENT_DATE - INTERVAL '1 DAY';
?column?|?column?
----------+----------------------
1999-01-08|1999-01-07 00:00:00+01
(1 row)
PostgreSQL has a syntax sligth different than SQL92. You have to enclose
'1 DAY' instead of '1' DAY.
-Jose'-
Kevin Heflin wrote:
>
> Trying to use select statement using CURRENT_DATE
> Which works fine like so:
>
> select * from headlines where dateof = CURRENT_DATE order by dateof desc
>
> But I'm also wanting to do something similar to:
>
> select * from headlines where dateof = CURRENT_DATE - INTERVAL '1' DAY
> order by dateof desc
>
> Basically just trying to subtract 1 day from the CURRENT_DATE
>
> When I try the above I get
>
> ERROR: parser: parse error at or near "day"
>
> Any suggestions would be appreciated.
>
> Kevin
>
> --------------------------------------------------------------------
> Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103
> VP/Mac Tech | 333 Texas St #619 | FAX:318.221.6612
> kheflin(at)shreve(dot)net | Shreveport, LA 71101 | http://www.shreve.net
> --------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Walt Bigelow | 1999-01-08 12:41:10 | postgresql v6.4.2 c funcs and null text pointers... |
Previous Message | Sergei Chernev | 1999-01-08 11:23:00 | Using Memory |
From | Date | Subject | |
---|---|---|---|
Next Message | Horak Daniel | 1999-01-08 13:26:54 | New patches for running PostgreSQL on Windows |
Previous Message | The Hermit Hacker | 1999-01-08 06:17:03 | Re: [HACKERS] Re: [PORTS] vacuum takes too long |