Re: pulling year out of a timestamp

Поиск
Список
Период
Сортировка
От Ryan Kelly
Тема Re: pulling year out of a timestamp
Дата
Msg-id 20130411155518.GB13565@llserver.lakeliving.com
обсуждение исходный текст
Ответ на pulling year out of a timestamp  (Kirk Wythers <wythe001@umn.edu>)
Ответы Re: pulling year out of a timestamp
Список pgsql-general
On Thu, Apr 04/11/13, 2013 at 10:50:53AM -0500, Kirk Wythers wrote:
> I am trying to perform a join between two tables where I need to join "year" in table 1 with the year component of a
timestampin table 2. 
>
> Something like this:
>
> table1.year = table2.timestamp
> where timestamp has the format:  "2009-01-01 00:00:00"
>
> I've tried
>
> date_trunc('year', table2.timestamp) = table1.year

You want date_part, not date_trunc.

-Ryan


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

Предыдущее
От: Kirk Wythers
Дата:
Сообщение: pulling year out of a timestamp
Следующее
От: Kirk Wythers
Дата:
Сообщение: Re: pulling year out of a timestamp