Quoth "Jay A. Kreibich" <j...@kreibi.ch>, on 2010-11-10 18:43:06 -0600: > > The observed useful behavior is to have such a reference return the > > value from the first row in each group, > > I haven't verified this since 3.6.23.1, but in that version the > *last* row is the one that is returned.
Hmm. Apparently I misremembered, then. > ORDER BY is applied after the GROUP BY and should not > have any meaning to the rows within a group. Any change > is likely a side-effect. It looks like you're right, and the resulting row selected is only arbitrary (though often the one with the largest rowid). This suggests that unless I'm misunderstanding the comparison, comparing SQLite's behavior of permitting this type of SELECT with Postgres's DISTINCT ON (as an earlier post in this thread did) is misleading, since DISTINCT ON is guaranteed to be semantically after ORDER BY processing and therefore allows controlling which row from a group is selected, if one is careful. Thanks for the corrections. > -j ---> Drake Wilson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users