Quoth Alexey Pechnikov <pechni...@mobigroup.ru>, on 2010-10-20 11:32:04 +0400: > This is just one replacement for "distinct on" clause, as example. And you > can use any sort order for non-aggregate values in your group so some > queries are more simple than equal "distinct on" form in other DBMS > (PostgreSQL, > etc.). The feature is extremely useful for many applications.
So here's the followup million-dollar question, then: is this behavior actually guaranteed? I can't find any reference to how exactly a reference to a non-aggregate result from outside a GROUP BY is interpreted semantically in the SQLite documentation, and nor do I think it's specified in SQL proper, especially since other engines raise errors in this case. The observed useful behavior is to have such a reference return the value from the first row in each group, and then to allow control of within-group ordering using ORDER BY. But is this part of the public interface, or is it an oddity that may change in future revisions? Hipp's response upthread seems to indicate the former, but I'd rather be sure. ---> Drake Wilson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users