Re: [SQL] this one's simpler

Поиск
Список
Период
Сортировка
От Maarten Boekhold
Тема Re: [SQL] this one's simpler
Дата
Msg-id Pine.SUN.3.91.980825093939.865A-100000@dutepp2.et.tudelft.nl
обсуждение исходный текст
Ответ на this one's simpler  (Eric McKeown <ericm@palaver.net>)
Ответы Having problems to compile SPI  (Jose David Martinez Cuevas <david@morgana.estadistica.unam.mx>)
Список pgsql-sql
On Mon, 24 Aug 1998, Eric McKeown wrote:

> Ok, I think this questions is a little bit easier.  I have this piece of
> code:
>
> select (max(date_asked) - min(date_asked))::timespan from questions ;
>
> And it produces this output:
>
> timespan
> ------------------------------------
> @ 2334 days 13 hours 21 mins 45 secs
> (1 row)
>
> Now, what I'd really like is a way to format that output into months so
> that I could see the difference between the two dates in terms of months.
> Pointers??

Well, since not every month has the same number of days, and not every
*year* has the same number of days, I think this would only be possible
if you also give same starting date (ie min(date_asked)). I'd try to
write a C-function for this I guess.

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
|                   Department of Electrical Engineering                    |
|           Computer Architecture and Digital Technique section             |
|                          M.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------


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

Предыдущее
От: Cho Yan Wong
Дата:
Сообщение: copy probs
Следующее
От: Andreas Schmidt
Дата:
Сообщение: Query otimizing possible?