Re: [SQL] this one's simpler
Maarten Boekhold <maartenb@dutepp2.et.tudelft.nl>
From: Maarten Boekhold <maartenb@dutepp2.et.tudelft.nl>
To: Eric McKeown <ericm@palaver.net>
Cc: PGsql <pgsql-sql@postgreSQL.org>
Date: 1998-08-25T07:40:58Z
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.Boekhold@et.tudelft.nl | -----------------------------------------------------------------------------