extract day from interval

Поиск
Список
Период
Сортировка
От Seb
Тема extract day from interval
Дата
Msg-id 87bq4zplqi.fsf@patagonia.sebmags.homelinux.org
обсуждение исходный текст
Ответы Re: extract day from interval  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

I'm not very savvy with interval manipulations, but I have a query like
this:

---<---------------cut here---------------start-------------->---
SELECT DISTINCT ON (table_a.id) table_a.id, table_a.var2,
       EXTRACT(DAY FROM (table_b.date - table_a.date)) AS age,
       FROM table_a INNER JOIN table_b
       ON (table_a.id = table_b.id)
       WHERE table_a.date IS NOT NULL
       ORDER BY table_a.pupid, age;
---<---------------cut here---------------end---------------->---

Is this an efficient way to get the days from the time interval?  Both
'date' columns are of type "Date".  Thanks.

Cheers,

--
Seb

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

Предыдущее
От: "Matthew T. O'Connor"
Дата:
Сообщение: pl/pgsql debugger rpms?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: extract day from interval