如何在没有group by的情况下使用slick进行多个聚合

时间:2015-03-26 12:40:14

标签: sql scala slick

也许有人告诉我如何在没有使用光滑的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

1 个答案:

答案 0 :(得分:0)