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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -