Aggregate functions on DATE and TIME

From: "Sverre H(dot) Huseby" <shh(at)computas(dot)no>
To: pgsql-sql(at)postgresql(dot)org
Subject: Aggregate functions on DATE and TIME
Date: 1998-09-14 07:32:18
Message-ID: 199809140732.JAA02993@aslan.computas.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

As far as I can see, the aggregate functon MAX isn't defined for type
TIME. I desperately need to extract the last sample for each day from
a database, and tried this statement:

SELECT MAX(time),date FROM samples GROUP BY date;

where the table samples contains

date DATE,
time TIME,

I get the following error:

ERROR: function max(time) does not exist

I've tried casting the time to a type for which MAX is defined, but I
was unable to find a casting function that was valid.

My questions are: Why isn't MAX defined for TIME? Will it be defined
in the future (no news about it in the 6.4-BETA1 HISTORY-file)? Any
alternative ways to get the result I want?

Thanks for your time!

Sverre.

--
Work: shh(at)computas(dot)no +47 67 55 52 69
Home: sverrehu(at)online(dot)no http://home.sol.no/~sverrehu/

Browse pgsql-sql by date

  From Date Subject
Next Message Szandor van Verseveld 1998-09-14 09:23:34 Re: [PHPLIB] SQL probs with phplib
Previous Message Eric McKeown 1998-09-11 18:12:05 Re: [SQL] connecting with password