v.25.11New Feature
New aggregate functions argAndMin and argAndMax
New aggregate functionsargAndMinandargAndMaxthat return the argument and the corresponding extreme value. In previous versions it was also possible by using a tuple as an argument. #89884 (AbdAlRahman Gad).
Why it matters
To provide a more direct and efficient way to retrieve the argument associated with the minimum or maximum value in aggregation queries, simplifying queries that previously required using tuples as arguments.How to use it
Use the aggregate functionsargAndMin(arg, value) and argAndMax(arg, value) in your SELECT queries to get the argument combined with the minimum or maximum of the corresponding values, for example:SELECT argAndMin(user_id, score) FROM table;
SELECT argAndMax(user_id, score) FROM table;