pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chairudin Sentosa <chairudin@prima.net.id>
To: pgsql-sql@postgresql.org
Subject: sum gives different answer
Date: Fri, 12 Mar 1999 04:28:41 -0700
Message-ID: <36E8FA69.4CA1832E@prima.net.id> (raw)

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

view thread (6+ messages)  latest in thread

Message-ID: <36E8FA69.4CA1832E@prima.net.id>
Permalink:  ../36E8FA69.4CA1832E@prima.net.id/
Also on:    postgresql.org/message-id/36E8FA69.4CA1832E@prima.net.id

 · 

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: chairudin@prima.net.id
  Subject: Re: sum gives different answer
  In-Reply-To: <36E8FA69.4CA1832E@prima.net.id>
  References: <36E8FA69.4CA1832E@prima.net.id>

* 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