pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: sql question regarding count(*)
Date: Fri, 7 Mar 2003 10:53:06 +0530
Message-ID: <200303071053.06820.mallah@trade-india.com> (raw)
In-Reply-To: <3E673874.5030606@klaster.net>
References: <200303061702.26339.mallah@trade-india.com>
	<3E673874.5030606@klaster.net>


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.



view thread (7+ messages)  latest in thread

Message-ID: <200303071053.06820.mallah@trade-india.com>
Permalink:  ../200303071053.06820.mallah@trade-india.com/
Also on:    postgresql.org/message-id/200303071053.06820.mallah@trade-india.com

 · 

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: pgsql-sql@postgresql.org
  Cc: mallah@trade-india.com, jasiek@klaster.net
  Subject: Re: sql question regarding count(*)
  In-Reply-To: <200303071053.06820.mallah@trade-india.com>

* 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