Re: substring ..

From: Jie Liang <jliang(at)jliang(dot)ipinc(dot)com>
To: Jeff MacDonald <jeff(at)hub(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: substring ..
Date: 2000-12-19 22:12:09
Message-ID: Pine.BSF.4.21.0012191400280.41512-100000@jliang.ipinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)ipinc(dot)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(at)pgsql(dot)com | jeff(at)hub(dot)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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message guard 2000-12-20 03:40:29 plpgsql ?
Previous Message Jie Liang 2000-12-19 21:58:05 Re: Create table doesn't work in plpgsql