From: | Tim Williams <williams(at)ugsolutions(dot)com> |
---|---|
To: | kheflin(at)shreve(dot)net (Kevin Heflin) |
Cc: | pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] select using date |
Date: | 1999-01-05 11:06:18 |
Message-ID: | 199901051706.LAA26380@ug.eds.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
> 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
Kevin,
(1) Handy hint: try '\df' once in the psql utility.
This gives a nice list of functions, their return types, and
brief descriptions of what they accomplish.
(2) The function for which you seek is probably "timemi" which
takes a time as its first argument and a time interval
(like 1 day) as its second argument.
For example, same time yesterday:
select timemi('now'::datetime, '1 day'::timespan);
- Tim
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Heflin | 1999-01-05 16:55:53 | select using date |
Previous Message | Scherf Andreas | 1999-01-05 10:34:06 | Creating Tables |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 1999-01-05 13:35:21 | Postgresql INSTALL-file & Windows |
Previous Message | Oleg Broytmann | 1999-01-05 10:48:24 | ./configure: conftest.sh not found |