pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sverre H. Huseby <shh@computas.no>
To: pgsql-sql@postgresql.org
Subject: Aggregate functions on DATE and TIME
Date: Mon, 14 Sep 1998 09:32:18 +0200 (MET DST)
Message-ID: <199809140732.JAA02993@aslan.computas.no> (raw)

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@computas.no		+47 67 55 52 69
Home:	sverrehu@online.no	http://home.sol.no/~sverrehu/




Message-ID: <199809140732.JAA02993@aslan.computas.no>
Permalink:  ../199809140732.JAA02993@aslan.computas.no/
Also on:    postgresql.org/message-id/199809140732.JAA02993@aslan.computas.no

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: shh@computas.no
  Subject: Re: Aggregate functions on DATE and TIME
  In-Reply-To: <199809140732.JAA02993@aslan.computas.no>
  References: <199809140732.JAA02993@aslan.computas.no>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox