Re: select sum() possible or not ?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <joerg(dot)naumann(at)miele(dot)de>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: select sum() possible or not ?
Date: 2002-03-14 15:43:38
Message-ID: 20020314074019.H433-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 14 Mar 2002 joerg(dot)naumann(at)miele(dot)de wrote:

> Hello,
>
> I'm using PostgreSQL 7.1
>
> I have a table like :
>
> date logon logoff
> ---------------------------------
> 01-01-02 | 12:02:03 | 12:04:23
> 01-01-02 | 12:05:13 | 12:08:13
> 01-01-02 | 13:02:03 | 13:04:23
> 01-01-02 | 14:02:03 | 14:04:23
> 01-02-02 | 08:59:03 | 09:09:23
> ........
>
> and I want to do the following select :
>
> select sum(logoff - logon) from online;
>
> but I receive a error that it's not possible to select a aggregate function
> sum(time).
>
> Does someone have an idea why, is there a configuration switch which could solve
> the problem?

I'd suggest upgrading to 7.2, it looks like the above works there.
Failing that maybe try a cast to interval? cast((logoff-logon) as
interval)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2002-03-14 15:47:38 Re: location of Large Object
Previous Message Doug McNaught 2002-03-14 15:40:28 Re: User permissions