From: | Alexander Turchin <aturchin(at)chip(dot)org> |
---|---|
To: | PostgreSQL Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | COUNTs don't add up |
Date: | 2001-07-23 19:32:04 |
Message-ID: | 3B5C7BB4.A69E20DE@chip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | wsheldah | 2001-07-23 20:09:55 | Re: Re: PASSWORD() function for postgresql? |
Previous Message | Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= | 2001-07-23 19:18:49 | Re: AutoStart and AutoDown |