eachAverageBy

inline fun <E : Any, T : BaseTable<E>, K : Any> EntityGrouping<E, T, K>.eachAverageBy(columnSelector: (T) -> ColumnDeclaring<out Number>): Map<K?, Double?>(source)

Group elements from the source sequence by key and average the columns or expressions provided by the columnSelector function for elements in each group.

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

Return

a Map associating the key of each group with the averaging result in the group.

Parameters

columnSelector

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