也许有人告诉我如何在没有使用光滑的group by
的情况下聚合多个列。我需要这样的例子(doesent' t)
val q = for {
d <- documents
dr <- documentRecords
if d.accountMonthId inSetBind monthIds
if d.documentType inSetBind DocumentType.currentDocuments
if dr.documentId === d.id
if dr.accountId === accountId
} yield (dr.map(dr => dr.debit,dr.credit).sum)
q.first
Sql查询应如下所示:
select sum(debit), sum(credit) from document join document_record where blahblahbalh