Quantcast
Channel: User Mark - Stack Overflow
Viewing all articles
Browse latest Browse all 44

Alias for an aggregate column

$
0
0

I would like to get the average of a column using Kotlin Exposed.

object MyTable: IntIdTable("MyTable") {    val score = integer("score")val result = MyTable.slice(        MyTable.score.avg().alias("avg_points")).first()

How do I get the result?

For normal columns I would use

result[MyTable.score]

But now it is an aggregate with an alias. I've tried

result["avg_points"]

But that fails. I don't see many public methods on ResultRow.


Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>