Received: from mail.austin.rr.com (sm1.texas.rr.com [24.93.35.54]) by hub.org (8.10.1/8.10.1) with ESMTP id e5MKXA130293 for ; Thu, 22 Jun 2000 16:33:10 -0400 (EDT) Received: from austin.rr.com ([24.93.36.87]) by mail.austin.rr.com with Microsoft SMTPSVC(5.5.1877.357.35); Thu, 22 Jun 2000 15:34:20 -0500 Message-ID: <39527922.D0C8E9F2@austin.rr.com> Date: Thu, 22 Jun 2000 15:37:54 -0500 From: Ed Loehr X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.12-20smp i686) X-Accept-Language: en MIME-Version: 1.0 To: Web Manager CC: pgsql-sql@postgresql.org Subject: Re: Wildcard in date field??? References: <39526E9B.418BB807@inter-resa.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200006/193 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