Re: compare month - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: compare month
Date
Msg-id 20060404070910.GD19326@webserv.wug-glas.de
Whole thread Raw
In response to compare month  (shakil tanvir <tanvirshakil@yahoo.com>)
List pgsql-novice
am  03.04.2006, um 23:58:50 -0700 mailte shakil tanvir folgendes:
> Hi all of you PostGreSQL fans,
>
> I need to run a query like
>
> SELECT users from userlog where lastlogindate is less than one month
> or
> SELECT users from userlog where lastlogindate is less than 15 days
>
> Can any one help with sql example?

Hey, read my answer in #postgresql ;-)

08:48 < shakil> i neeed to compare days in sql query like "SELECT users from userlog where lastLoginDate is 7 days old"
08:48 < shakil> can any one help?
08:49 < shakil> or SELECT users from userlog where lastLoginDate is one month old
08:51 < akretschmer> shakil: select .... where lastLoginDate > current_date - '7days'::interval
08:51 < akretschmer> shakil: you can also use '1month'::interval


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

pgsql-novice by date:

Previous
From: shakil tanvir
Date:
Subject: compare month[modified]
Next
From: Michael Glaesemann
Date:
Subject: Re: compare month