| From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
|---|---|
| To: | shakil tanvir <tanvirshakil(at)yahoo(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: compare month |
| Date: | 2006-04-04 07:10:40 |
| Message-ID: | 9E27CE9E-BBA0-42C2-85BC-C795A13E41F2@myrealbox.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
Hi!
On Apr 4, 2006, at 15:58 , shakil tanvir wrote:
> Hi all of you PostGreSQL fans,
True fans spell it PostgreSQL :)
> SELECT users from userlog where lastlogindate is less than one month
> or
select users
from userlog
where lastlogindate > current_timestamp - 1 * interval '1 month';
> SELECT users from userlog where lastlogindate is less than 15 days
select users
from userlog
where lastlogindate > current_timestamp - 15 * interval '1 day';
You can also use current_date instead of current_timestamp, depending
on your desired data type.
Hope this helps!
Michael Glaesemann
grzm myrealbox com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kaloyan Iliev | 2006-04-04 07:13:12 | Re: compare month |
| Previous Message | A. Kretschmer | 2006-04-04 07:09:10 | Re: compare month |