On 28 Aug 2014, at 3:45pm, Richard Hipp <d...@sqlite.org> wrote: > On Thu, Aug 28, 2014 at 10:38 AM, Gabor Grothendieck < > ggrothendi...@gmail.com> wrote: > >> The wording in the cited link is that >> >> "Queries of the form: "SELECT max(x), y FROM table" returns the value >> of y on the same row that contains the maximum x value." >> >> There is some question of whether min(x) is "of the form" max(x). > > It is. That behavior is defined and tested for min() and max(). But it > doesn't work for any other aggregate function. Note also that if you have > multiple min() and/or max() aggregate functions in the same query, then the > result will be from the row in which one of them is the min() or the max(), > but which one is arbitrary. So it is only well-defined if you have a > single min() or a single max().
Similarly, it's possible that two or more rows in the table will have the maximum value for column x. There's no rule about which of them will be chosen to have its y value returned or even that SQLite will be consistent about it. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users