我有一个查询,返回表列中值的总和。我现在还想返回行数。
下面是我当前查询的样子:
db.select(DSL.coalesce(DSL.sum(AMOUNT), 0).cast(Long::class.java))
.from(this.innerJoin(ACCOUNT).on(ACCOUNT_ID.eq(ACCOUNT.ID)))
.where(ACCOUNT.ACCOUNT_ID.eq(accId))
.awaitSingle()
.value1()
1条答案
按热度按时间r8uurelv1#
您可以只add another aggregate function to the same jOOQ query,例如:
这个答案假设通常的
import org.jooq.impl.DSL.*