Re: sql question regarding count(*)

Поиск
Список
Период
Сортировка
От Rajesh Kumar Mallah
Тема Re: sql question regarding count(*)
Дата
Msg-id 200303071053.06820.mallah@trade-india.com
обсуждение исходный текст
Ответ на Re: sql question regarding count(*)  (Tomasz Myrta <jasiek@klaster.net>)
Ответы Re: sql question regarding count(*)
Список pgsql-sql
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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: disable constraints
Следующее
От: jasiek@klaster.net
Дата:
Сообщение: Re: Cancelling Queries