Re: substring .. - Mailing list pgsql-sql

From Jie Liang
Subject Re: substring ..
Date
Msg-id Pine.BSF.4.21.0012191400280.41512-100000@jliang.ipinc.com
Whole thread Raw
In response to substring ..  (Jeff MacDonald <jeff@hub.org>)
List pgsql-sql
Hi,there,

I am not sure what is your question mean. However,
if the type of datefoo is a timestamp then try:
select foo from table where date(datefoo) = '2000-12-14';
select foo from table where datefoo::date = '2000-12-14'::date;

select foo from table where substr(datefoo,1,10) = '2000-12-14';
might work also.

Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com

On Tue, 19 Dec 2000, Jeff MacDonald wrote:

> hi folks..
> 
> i want to do this to a datetime field..
> 
> select foo from table where substr(datefoo,1,11) = '2000-12-14';
> 
> it returns no results yet..
> 
> select substr(datefoo,1,11) does return some values that say
> 2000-12-14
> 
> any clues ?
> 
> Jeff MacDonald,
> 
> -----------------------------------------------------
> PostgreSQL Inc        | Hub.Org Networking Services
> jeff@pgsql.com        | jeff@hub.org
> www.pgsql.com        | www.hub.org
> 1-902-542-0713        | 1-902-542-3657
> -----------------------------------------------------
> Facsimile : 1 902 542 5386
> IRC Nick  : bignose
> PGP Public Key : http://bignose.hub.org/public.txt
> 



pgsql-sql by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: how to alter/drop check contraint?
Next
From: Jie Liang
Date:
Subject: Re: Create table doesn't work in plpgsql