That's SQL standard -- query with aggregate functions always return at least one row.
Pavel On Fri, Feb 22, 2013 at 12:06 PM, Pierre Chatelier <k...@club-internet.fr> wrote: > Hello, > > [tested under 3.6.12 and 3.7.15.2] > > I have a question regarding the use of aggregate functions. > > Let's imagine the following db : >>create table A (id1 INTEGER UNIQUE PRIMARY KEY, id2 INTEGER); > It is empty. > > The following query : >>select id1,id2 from A; > returns nothing, there is no row. > > However, the following query, using the aggregate min() : >>select min(id1),id2 from A; > returns an empty line (displays '|' in the shell). > > Using avg(), max()... will do the same. > > With the C interface, SQLITE_ROW is returned, and I must test > sqlite_column_type() against SQLITE_NULL to check that in fact, there is no > result. > > Is this expected behaviour ? > > Regards, > > Pierre Chatelier > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users