Re: Wildcard in date field???

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: Web Manager <web(at)inter-resa(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Wildcard in date field???
Date: 2000-06-22 20:37:54
Message-ID: 39527922.D0C8E9F2@austin.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Web Manager wrote:
>
> I need to make a query that will select items that have a date matching
> the current month for example.
>
> For June this means that any day between 2000-06-01 and 2000-06-30 are
> ok. To do that I need a wildcard like "%" to replace the actual day in
> the date field.
>
> Ex.: select * from item where date = '2000-06-%%';

Multiple ways to do it, but here's one:

select *
from item
where date_part('month',mydate) = 6
and date_part('year',mydate) = 2000;

Regards,
Ed Loehr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dorin Grunberg 2000-06-22 21:27:35 Re: Wildcard in date field???
Previous Message Web Manager 2000-06-22 19:52:59 Wildcard in date field???