A lot of what we're mentioning is in http://www.sqlite.org/lang_select.html in 
section 3.

For what Keith mentioned below a reminder that min() and max() are special 
cases where the bare columns are guaranteed to be from same row as (one of the) 
min or max values. Any other expressions are only guaranteed to be from "an 
undefined one of" the grouped rows. (But every column in any one single output 
row will have been calculated from the same input row)



-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Keith Medcalf
Sent: Wednesday, May 24, 2017 1:22 PM
To: SQLite mailing list
Subject: Re: [sqlite] Group by Literals

This means that you can do things like:

SELECT a, b, max(c) FROM t GROUP BY a;

And you will be returned the groups of values of a, the max value of c in that 
group, and the value of b from (one of the rows) containing that maximum value. 
 The actual row (assuming multiple rows have the same max(c)) is undefined (but 
is in fact determined by the visitation order of the underlying table 
containing c).
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to