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