Re: sql question regarding count(*)

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: Tomasz Myrta <jasiek(at)klaster(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sql question regarding count(*)
Date: 2003-03-07 06:11:03
Message-ID: 20030306220603.P87448-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 7 Mar 2003, Rajesh Kumar Mallah wrote:

> Tomasz did you notice the two queries are totally differet on different
> tables?

A count() on a non-grouped table returns 1 row.

A grouped table returns 1 row per group. If there are no groups, no rows
are returned. If the groups are filtered by a having clause, it might
also return no rows.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-03-07 06:31:38 Re: sql question regarding count(*)
Previous Message jasiek 2003-03-07 05:27:05 Re: Cancelling Queries