On Thu, Jun 21, 2012 at 3:41 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > On 6/21/2012 12:17 PM, Pavel Ivanov wrote: >> >> On Thu, Jun 21, 2012 at 11:47 AM, Marco Bambini <ma...@sqlabs.net> wrote: >>> >>> Consider the following example: >>> >>> CREATE TABLE t1(x); >>> CREATE TABLE t2(y); >>> SELECT max((SELECT avg(x) FROM t2)) FROM t1; >>> >>> With sqlite 3.7.11 NULL is returned, while with sqlite 3.7.13 an error >>> "Misuse of aggregate: avg()" is returned. >>> Any thought? >> >> >> 3.7.11 had a bug, 3.7.13 fixed it. Your query is invalid, t2 doesn't >> have column named x. > > > But t1 does, and a nested select should be able to access it. I don't see > why an aggregate function can't be applied to any expression, even one that > happens to be constant across all rows of the table. > > I don't understand what makes this query invalid. Pointless, yes, but why > invalid?
So you are saying that behavior of such query should be equivalent to "SELECT max(x) FROM t1"? I didn't think about it like that... Probably you are right. Pavel _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users