Re: [SQL] this one's simpler

From: Maarten Boekhold <maartenb(at)dutepp2(dot)et(dot)tudelft(dot)nl>
To: Eric McKeown <ericm(at)palaver(dot)net>
Cc: PGsql <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] this one's simpler
Date: 1998-08-25 07:40:58
Message-ID: Pine.SUN.3.91.980825093939.865A-100000@dutepp2.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jose David Martinez Cuevas 1998-08-25 15:22:14 Re: [SQL] copy probs
Previous Message Cho Yan Wong 1998-08-25 02:17:45 copy probs