From: Dorin Grunberg <dorin@visgen.com>
To: Web Manager <web@inter-resa.com>
To: pgsql-sql@postgresql.org
Subject: Re: Wildcard in date field???
Date: Thu, 22 Jun 2000 16:27:35 -0500
Message-ID: <4.2.0.58.20000622162214.00ab5950@pophost> (raw)
In-Reply-To: <39526E9B.418BB807@inter-resa.com>
SELECT * FROM my_table WHERE date_part('month', col_name::datetime) = '06'
AND date_part('year', col_name::datetime) = '2000';
Looks for more detail in the manual for "date_part"
Dorin
At 03:52 PM 6/22/2000 -0400, Web Manager wrote:
>Hello,
>
>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-%%';
>
>but that doesn't work... What is the right way?
>
>Thanks!
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Marc Andre Paquin
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: dorin@visgen.com, web@inter-resa.com
Subject: Re: Wildcard in date field???
In-Reply-To: <4.2.0.58.20000622162214.00ab5950@pophost>
References: <39526E9B.418BB807@inter-resa.com> <4.2.0.58.20000622162214.00ab5950@pophost>
* 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