From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | Syl <david(dot)hunter(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Extract between year *and* month |
Date: | 2006-11-27 09:22:22 |
Message-ID: | 456AAE4E.9010407@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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!
--
Alban Hertroys
alban(at)magproductions(dot)nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Staubo | 2006-11-27 09:34:21 | Re: Slow left outer join |
Previous Message | Alban Hertroys | 2006-11-27 09:18:14 | Re: indexes |