3 ms·
SQLite takes it one step further. https://sqlite.org/quirks.html#aggregate_queries_can_contain_non_aggregate_result_columns_that_are_not_in_the_group_by_clause
by Zecc 7y ago
SQLite takes it one step further.
https://sqlite.org/quirks.html#aggregate_queries_can_contain_non_aggregate_result_columns_that_are_not_in_the_group_by_clause https://sqlite.org/quirks.html#aggregate_queries_can_contain...
> if an aggregate query contains a single min() or max() function, then the values of columns used in the output are taken from the row where the min() or max() value was achieved. If two or more rows have the same min() or max() value, then the columns values will be chosen arbitrarily from one of those rows.
Also here:
https://sqlite.org/lang_select.html#bareagg https://sqlite.org/lang_select.html#bareagg
> When the min() or max() aggregate functions are used in an aggregate query, all bare columns in the result set take values from the input row which also contains the minimum or maximum. [...] There is still an ambiguity if two or more of the input rows have the same minimum or maximum value or if the query contains more than one min() and/or max() aggregate function.
Would have been nice if adding an ORDER BY would allow disambiguating.