On 6/21/2012 3:52 PM, Pavel Ivanov wrote:
CREATE TABLE t1(x);
CREATE TABLE t2(y);
SELECT max((SELECT avg(x) FROM t2)) FROM t1;
So you are saying that behavior of such query should be equivalent to
"SELECT max(x) FROM t1"?
Not quite, but you get the idea. I think "select avg(SomeConstExpr) from
t2" would return NULL rather than SomeConstExpr if t2 is empty. So it
should be equivalent to
select max(case when (select count(*) from t2) == 0 then null else x
end) from t1;
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users