Re: Retrieve month from date

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: RPK <rpk(dot)general(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Retrieve month from date
Date: 2007-04-20 17:46:28
Message-ID: 1177091187.24411.25.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 2007-04-20 at 12:30, RPK wrote:
> What this query will return:
>
> Select Extract(Month from 4/20/2007) from dual;
>
> I suspect "dual" is not for PGSQL but Oracle. But I need to run the above
> query. What is the replacement of "dual" in PGSQL.
>

Well, you're going to have to create a special one row table with
contraints and triggers to always keep it at one row and now allow
anyone to insert into it and...

just kidding. All you need is:

select extract(month from '4/20/2007'::date);

i.e. no need for the extraneous from dual there.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Wei Weng 2007-04-20 18:53:40 Question on interval
Previous Message A. Kretschmer 2007-04-20 17:43:40 Re: Retrieve month from date