RE: [SQL] Date type select

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: Paulo Roberto Kappke <paulok(at)cyclades(dot)com(dot)br>, pgsql-sql(at)postgreSQL(dot)org
Subject: RE: [SQL] Date type select
Date: 1999-09-22 15:12:47
Message-ID: D05EF808F2DFD211AE4A00105AA1B5D259871E@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

template1=> select date_trunc('month', now());
date_trunc
----------------------------
Wed Sep 01 00:00:00 1999 CDT
(1 row)

template1=> select date_trunc('month', now()) = '9/1/1999';
?column?
--------
t
(1 row)

Enjoy,
DEJ

> -----Original Message-----
> From: Paulo Roberto Kappke [SMTP:paulok(at)cyclades(dot)com(dot)br]
> Sent: Wednesday, September 22, 1999 8:13 AM
> To: pgsql-sql(at)postgreSQL(dot)org
> Subject: [SQL] Date type select
>
> Hi all,
>
> I'm having a problem to make a select statement with a date type field.
>
> I have a table with a field named date_in and this field is a date type.
> Well, I need to do a select where the month is 09 and the year is 1999.
> I tried:
>
> SELECT * FROM calls WHERE date_in LIKE '09%1999' ORDER BY date_in
>
> or
>
> SELECT * FROM calls WHERE date_in LIKE '09-__-1999' ORDER BY date_in
>
> or
>
> SELECT * FROM calls WHERE date_in LIKE '09%' AND date_in LIKE '%1999'
> ORDER BY date_in
>
> using psql command and I received the following message:
>
> ERROR: There is more than one possible operator '~~' for types 'date'
> and 'unknown'
> You will have to retype this query using an explicit cast
>
>
> Could anybody help me ?
>
>
> Thanks in advance,
> Paulo Kappke
> Cyclades Brazil
>
> ************

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-09-22 15:13:31 Re: [SQL] [GENERAL] UPDATE feature or bug?
Previous Message Tom Lane 1999-09-22 15:06:26 Re: [SQL] decimal