sum gives different answer

From: Chairudin Sentosa <chairudin(at)prima(dot)net(dot)id>
To: pgsql-sql(at)postgresql(dot)org
Subject: sum gives different answer
Date: 1999-03-12 14:14:21
Message-ID: 36E9213D.151B90E1@prima.net.id
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

I have two SQL statements that I expect to give (0 rows) as output.
However the first one with 'sum' does not do that.
Why the first SQL statement gives (1 row) and empty?
While the second SQL statement can give (0 row).
I am using postgresql 6.4.2.

First
------
select pin, sum(duration) from tablename where date(start_time)=
(select date 'today') group by pin;

pin|sum
---+---
|
(1 row)

Second
------
select pin, duration from tablename where date(start_time)=
(select date 'today') group by pin;

pin|duration
---+--------
(0 rows)

Could anyone tell me why, please?

Regards
Chai

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-03-12 15:57:31 Re: Very disappointing performance -- All Indexes Ignored.
Previous Message ZioBudda 1999-03-12 13:03:38 where can I get...