Re: Retrieve month from date - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: Retrieve month from date
Date
Msg-id 1177091187.24411.25.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: Retrieve month from date  (RPK <rpk.general@gmail.com>)
List 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.


pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Retrieve month from date
Next
From: Wei Weng
Date:
Subject: Question on interval