public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alexander Turchin <[email protected]>
To: PostgreSQL Mailing List <[email protected]>
Subject: COUNTs don't add up
Date: Mon, 23 Jul 2001 15:32:04 -0400
Message-ID: <[email protected]> (raw)
Hello all,
I have a database where (I believe; the database was not made by me) one
of the columns contains only two values: A or B. When I count all the
rows in the database I get X; when I count the rows containing A or B in
that column I get X-2; when I count the rows containing neither A nor B
I get 0. Any explanation (hopefully, again, I am doing something wrong
:)?
The actual queries are found below.
Thanks!
Alex
aturchin=# SELECT COUNT(*) FROM homol_loclink
aturchin-# WHERE (species2 = 'Mus musculus') OR
aturchin-# (species2 = 'Rattus norvegicus');
count
-------
7110
(1 row)
aturchin=# SELECT COUNT(*) FROM homol_loclink;
count
-------
7112
(1 row)
aturchin=# SELECT COUNT(*) FROM homol_loclink
aturchin-# WHERE (species2 <> 'Mus musculus') AND
aturchin-# (species2 <> 'Rattus norvegicus');
count
-------
0
(1 row)
view thread (4+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: COUNTs don't add up
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox