From: | "Francis Solomon" <francis(at)stellison(dot)co(dot)uk> |
---|---|
To: | "Jeff MacDonald" <jeff(at)hub(dot)org>, "Pgsql-Sql(at)Postgresql(dot) Org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: substring .. |
Date: | 2000-12-19 20:14:00 |
Message-ID: | NEBBIFFPELJMCJAODNPKMECECEAA.francis@stellison.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Jeff,
'2000-12-14' is only 10 chars long.
You're asking for an 11-char long substring to match a 10-char ... not
going to happen!
You can see this better if you do something like this ...
select '@' || substr(datefoo,1,11) || '@' from table;
... and you'll get results like:
@2000-12-14 @
So, you could modify your query to do:
select foo from table where substr(datefoo, 1, 10) = '2000-12-14';
Alternatively, what's wrong with this approach?
select foo from table where date(datefoo) = '2000-12-14';
I think that might execute a little faster.
Hope this helps
Francis Solomon
> 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,
From | Date | Subject | |
---|---|---|---|
Next Message | Robert B. Easter | 2000-12-19 21:31:42 | Re: substring .. |
Previous Message | Tulio Oliveira | 2000-12-19 20:13:09 | Re: substring .. |