Thread: compare month[modified]

compare month[modified]

From
shakil tanvir
Date:
Hi all of you PostGreSQL fans,

I need to run a query like

SELECT users from userlog where lastlogindate is less than one month of current date
or
SELECT users from userlog where lastlogindate is less than 15 days of current date

Can any one help with sql example?

Shakil
tanvirshakil@yahoo.com


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

Re: compare month[modified]

From
Kaloyan Iliev
Date:
Hi,
SELECT users from userlog where lastlogindate > CURRENT_DATE-'1
month'::interval;
or
SELECT users from userlog where lastlogindate > CURRENT_DATE-'15
days'::interval;


I think this will work for you.

Have a nice day

Kaloyan Iliev


shakil tanvir wrote:

> Hi all of you PostGreSQL fans,
>
> I need to run a query like
>
> SELECT users from userlog where lastlogindate is less than one month
> of current date
> or
> SELECT users from userlog where lastlogindate is less than 15 days of
> current date
>
> Can any one help with sql example?
>
> Shakil
> tanvirshakil@yahoo.com
>
> ------------------------------------------------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> to the US (and 30+ countries) for 2ў/min or less.



Re: compare month[modified]

From
george young
Date:
On Tue, 4 Apr 2006 00:05:49 -0700 (PDT)
shakil tanvir <tanvirshakil@yahoo.com> threw this fish to the penguins:

> Hi all of you PostGreSQL fans,
>
> I need to run a query like
>
> SELECT users from userlog where lastlogindate is less than one month of current date
> or
> SELECT users from userlog where lastlogindate is less than 15 days of current date

The "age" builtin function is handy in these circumstances:

  select users from userlog where age(lastlogindate) < '1 month';


> Can any one help with sql example?
>
> Shakil
> tanvirshakil@yahoo.com
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.


--
"Are the gods not just?"  "Oh no, child.
What would become of us if they were?" (CSL)