Search Postgresql Archives

Re: Extract between year *and* month

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux