Re: pattern matching with dates?

Поиск
Список
Период
Сортировка
От pasman pasmański
Тема Re: pattern matching with dates?
Дата
Msg-id AANLkTi=pahSTCHk07nj79KjSoXa8DhqUv5mA7Z3FdcEX@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pattern matching with dates?  (Susanne Ebrecht <susanne@2ndQuadrant.com>)
Ответы Re: pattern matching with dates?  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Sorry, but this examples not use index.

On 1/7/11, Susanne Ebrecht <susanne@2ndquadrant.com> wrote:
> Hello Thomas,
>
> On 05.01.2011 20:39, Good, Thomas wrote:
>> select * from db_log where log_date LIKE '2011-01-%';
>
> The lazy way would be something like this:
> SELECT * from tab WHERE log_date::VARCHAR LIKE '2011-01-%';
>
> The more proper way is:
>   SELECT * from tab WHERE EXTRACT(YEAR FROM log_date) = 2011 and
> EXTRACT(MONTH FROM log_date) = 1;
>
> Susanne
>
> --
> Susanne Ebrecht - 2ndQuadrant
> PostgreSQL Development, 24x7 Support, Training and Services
> www.2ndQuadrant.com
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

-- 
Sent from my mobile device

------------
pasman


В списке pgsql-sql по дате отправления:

Предыдущее
От: Susanne Ebrecht
Дата:
Сообщение: Re: pattern matching with dates?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: pattern matching with dates?