Hello,

this mail is about the aggregate feature that was unveiled in the release log of version 3.17.11, http://www.sqlite.org/releaselog/3_7_11.html :

A query of the form: "SELECT max(x), y FROM table" returns the value of y on the same row that contains the maximum x value.

I just want to point to a construction where one would expect this to work however it does not. I tried a query that returns only the value of y and intuitively wrote:

select y from (select max(x), y from t);

This however no longer returns the value of y corresponding to the maximum x.

It looks a consequence of query optimization. The query satisfies all conditions for "Query Flattening" in http://www.sqlite.org/optoverview.html . The max(x) column is then eliminated.

Hope this is useful to know for who is using the feature.

EPasma

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to