Received: from hotmail.com (f30.law14.hotmail.com [64.4.21.30]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6NKYGf63269 for ; Mon, 23 Jul 2001 16:34:17 -0400 (EDT) (envelope-from oomoomi@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 23 Jul 2001 13:34:13 -0700 Received: from 213.29.16.6 by lw14fd.law14.hotmail.msn.com with HTTP; Mon, 23 Jul 2001 20:34:13 GMT X-Originating-IP: [213.29.16.6] From: "omid omoomi" To: aturchin@chip.org, pgsql-general@postgresql.org Subject: Re: COUNTs don't add up Date: Mon, 23 Jul 2001 20:34:13 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 23 Jul 2001 20:34:13.0436 (UTC) FILETIME=[D5C297C0:01C113B6] X-Archive-Number: 200107/854 X-Sequence-Number: 12975 hi , try this : select species2, count(*) from homol_loclink group by species2; it will show you. Regards Omid >From: Alexander Turchin >To: PostgreSQL Mailing List >Subject: [GENERAL] COUNTs don't add up >Date: Mon, 23 Jul 2001 15:32:04 -0400 > >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) > > > >---------------------------(end of broadcast)--------------------------- >TIP 3: if posting/reading through Usenet, please send an appropriate >subscribe-nomail command to majordomo@postgresql.org so that your >message can get through to the mailing list cleanly _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp