Re: Extract between year *and* month - Mailing list pgsql-general

From Syl
Subject Re: Extract between year *and* month
Date
Msg-id 1164918068.586197.174450@j44g2000cwa.googlegroups.com
Whole thread Raw
In response to Re: Extract between year *and* month  (Alban Hertroys <alban@magproductions.nl>)
List pgsql-general
Alban Hertroys wrote:
> Syl wrote:
> >> Try
> >>
> >> select *
> >>  from tablename
> >>     where title like ('%nith%')
> >>        and date_trunc('month',recall_date::timestamp) >= date_trunc('month','1995-01-01'::timestamp)
> >>        and date_trunc('month',recall_date::timestamp) <= date_trunc('month','2006-12-31'::timestamp)
> >>                   order by recall_date
> >>
>
> Actually, that looks a lot like BETWEEN, which is even shorter :)
>
>  select *
>    from tablename
>   where title like ('%nith%')
>     and date_trunc('month',recall_date::timestamp)
>     between date_trunc('month','1995-01-01'::timestamp)
>         and date_trunc('month','2006-12-31'::timestamp)
>   order by recall_date
>
>
> > Fantastic.
> >
> > Thank you to Matthias and Russell - everything is working perfectly!
>


Thank you for the accurate and detailed repsonses! All is working
excellent.


pgsql-general by date:

Previous
From: adurrant@cogeco.ca
Date:
Subject: 8.1.5 installation problem with initdb on WinXP Home
Next
From: Dave Bodenstab
Date:
Subject: Re: Create index on array element?