X-Original-To: pgsql-sql@postgresql.org Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id EB7EA476393 for ; Fri, 7 Mar 2003 00:21:08 -0500 (EST) Received: (qmail 28849 invoked from network); 7 Mar 2003 05:20:36 -0000 Received: from unknown (HELO system67.trade-india-local.com) (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 7 Mar 2003 05:20:36 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: Tomasz Myrta Subject: Re: sql question regarding count(*) Date: Fri, 7 Mar 2003 10:53:06 +0530 User-Agent: KMail/1.5 Cc: pgsql-sql@postgresql.org References: <200303061702.26339.mallah@trade-india.com> <3E673874.5030606@klaster.net> In-Reply-To: <3E673874.5030606@klaster.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200303071053.06820.mallah@trade-india.com> X-Archive-Number: 200303/173 X-Sequence-Number: 12213 Tomasz did you notice the two queries are totally differet on different tables? On Thursday 06 March 2003 05:30 pm, Tomasz Myrta wrote: > Rajesh Kumar Mallah wrote: > > When does count(*) returns "o rows" ? > > and when does it return 1 row value being 0. > > > > tradein_clients=# SELECT count(*) from public.eyp_listing where sno> 0 > > and amount> 0 group by sno,branch,edition having count(distinct userid) > > > 1 ; count > > ------- > > (0 rows) > > > > tradein_clients=# > > tradein_clients=# > > tradein_clients=# SELECT count(*) from public.users where userid=-1; > > count > > ------- > > 0 > > (1 row) > > > > tradein_clients=# > > It's because of your having clause. > If count(*)=0 then having count(*)>1 results in no rows. > > Regards, > Tomasz Myrta -- Regds Mallah ---------------------------------------- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.