Tim Romano <tim.rom...@yahoo.com> wrote: > select min(c) from T where 1=2 > > returns 1 row that contains <null> despite the presence of the > aggregate function
Not despite - _because_ of. If you didn't have the aggregate there, you'd get zero rows. > and so > > select min(c) is null from T where 1 =2 > > returns true (1). But > > select min(c) from T where 1=2 > /group by/ foo > > returns no rows, presumably because the null value was removed from > the aggregated set. No - because now there are no groups (as opposed to one group with zero rows as in the previous statement). It is somewhat illogical - I can't think of any logical reason why an empty resultset (without group by) should be treated as one group with zero rows, and not as zero groups (and, thus, why the first statement should produce one row). But that's the way all SQL engines I know about have behaved for as long as I can remember. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users