Subject Re: [firebird-support] Looking for explanation of count and group by
Author Milan Babuskov
Bob Murdoch wrote:
> Just ran across a situation that I can't explain. Not because anything is
> wrong, just because I can't figure it out.
> Given the table "create table test_group_by(column1 integer)"
> I can run this query and receive a single row result set with a count of 0:
> select
> count(*)
> from
> test_group_by


> However, if I change the query to
> select
> column1, count(*)
> from
> test_group_by
> group by
> column1

> I recieve an empty result set. I think I would have expected a single row,
> with column1=NULL and a count of 0.

Why would you expect it? Did you read it in some book, or maybe seen
some other server does it or ...?

There are no rows in table, so we don't expect any rows in result which
show values of that column (as first column of result). It wouldn't give
us any information if we know that we have zero null values in that
column. If we were to follow your logic, we could expect to also see a
row like: column1=10 and a count of 0, etc.

Milan Babuskov