eachMaxByTo

inline fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachMaxByTo(destination: M, columnSelector: (T) -> ColumnDeclaring<C>): M(source)

Group elements from the source sequence by key and get the max value of the columns or expressions provided by the columnSelector function for elements in each group, then store the results in the destination map.

The key for each group is provided by the EntityGrouping.keySelector function, and the generated SQL is like: select key, max(column) from source group by key.

Return

a destination map associating the key of each group with the max value in the group.

Parameters

destination

a MutableMap used to store the results.

columnSelector

a function that accepts the source table and returns a column or expression.