如何在 Exposed 中使用 QueryAlias 从 ResultRow 映射 count() 值
或者我做错了什么?
val countAlias = EventTable.join(AttendeeEventTable, JoinType.INNER)
.slice(EventTable.id, EventTable.id.count())
.selectAll()
.groupBy(EventTable.id)
.alias("countAlias")
EventTable
.join(countAlias, JoinType.LEFT, EventTable.id, countAlias[EventTable.id])
.selectAll()
.map {
Event(
id = it[EventTable.id].value,
name = it[EventTable.name],
countOfAttendeees = it[countAlias[EventTable.id.count()]], //Not working. How to get the count() from ResultRow
)
}