pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ed Loehr <eloehr@austin.rr.com>
To: Web Manager <web@inter-resa.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Wildcard in date field???
Date: Thu, 22 Jun 2000 15:37:54 -0500
Message-ID: <39527922.D0C8E9F2@austin.rr.com> (raw)
References: <39526E9B.418BB807@inter-resa.com>

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



view thread (4+ messages)  latest in thread

Message-ID: <39527922.D0C8E9F2@austin.rr.com>
Permalink:  ../39527922.D0C8E9F2@austin.rr.com/
Also on:    postgresql.org/message-id/39527922.D0C8E9F2@austin.rr.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: eloehr@austin.rr.com, web@inter-resa.com
  Subject: Re: Wildcard in date field???
  In-Reply-To: <39527922.D0C8E9F2@austin.rr.com>
  References: <39526E9B.418BB807@inter-resa.com> <39527922.D0C8E9F2@austin.rr.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox