RE: substring ..
От | Francis Solomon |
---|---|
Тема | RE: substring .. |
Дата | |
Msg-id | NEBBIFFPELJMCJAODNPKMECECEAA.francis@stellison.co.uk обсуждение исходный текст |
Ответ на | substring .. (Jeff MacDonald <jeff@hub.org>) |
Список | 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,
В списке pgsql-sql по дате отправления: