scala - How to make a query in Slick 3 to select from DB with count from children tables -
how can make query in slick 3.0 ?
select *,(select count(*) flashcards setid = flashcards_sets.id ) allcount,(select count(*) flashcards studied = true , setid = flashcards_sets.id ) studiedcount flashcards_sets;
private def filterbyflashcardquery(id: int): query[flashcards, flashcard, seq] = flashcards.filter(_.setid === id && _.studied = true) def findbyflashcardlength(flashcardid: int):future[int] = { try db.run(filterbyflashcardquery(flashcardid).length.result) println("db.close")//db.close }
```
Comments
Post a Comment