From: Daniel Wickstrom <danw@rtp.ericsson.se>
To: pgsql-sql@postgresql.org
Subject: Re: COUNT
Date: Thu, 19 Oct 2000 14:30:21 -0400 (EDT)
Message-ID: <14831.15805.753626.426101@gargle.gargle.HOWL> (raw)
In-Reply-To: <5.0.0.25.2.20001019140625.049308b0@pop.mindspring.com>
References: <20000906202707.A4767@s2.enthdimension.com.au>
<5.0.0.25.2.20001019140625.049308b0@pop.mindspring.com>
>>>>> "Brian" == Brian C Doyle <bcdoyle@mindspring.com> writes:
Brian> Hello, You will need to do "SELECT count(attribute) FROM
Brian> table;" or SELECT count(table.attribute);"
You need to watch this:
acspg=# create table tst (
acspg(# a integer
acspg(# );
CREATE
acspg=# insert into tst values (0);
INSERT 333481 1
acspg=# insert into tst values (null);
INSERT 333482 1
acspg=# insert into tst values (2);
INSERT 333483 1
acspg=# select count(*) from tst;
count
-------
3
(1 row)
acspg=# select count(a) from tst;
count
-------
2
(1 row)
acspg=# select count(1) from tst;
count
-------
3
(1 row)
acspg=#
If you use the attribut name, null values won't be counted.
-Dan
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: danw@rtp.ericsson.se
Subject: Re: COUNT
In-Reply-To: <14831.15805.753626.426101@gargle.gargle.HOWL>
* 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