Re: compare month

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: compare month
Date: 2006-04-04 07:09:10
Message-ID: 20060404070910.GD19326@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ===

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2006-04-04 07:10:40 Re: compare month
Previous Message shakil tanvir 2006-04-04 07:05:49 compare month[modified]