Nested select Query ?

9 views
Skip to first unread message

techlan...@gmail.com

unread,
Jul 10, 2017, 11:59:50 AM7/10/17
to Slick / ScalaQuery
Hi all 
how can write sql command like this in slick ?
SELECT [dmn].localDomain_domain FROM localDomain as [dmn] WHERE [dmn].localDomain_id = (SELECT TOP 1 [para].returnPathDomain_id FROM para as [para])
thanks ? 

Richard Dallaway

unread,
Jul 10, 2017, 1:47:09 PM7/10/17
to Slick / ScalaQuery
Hello

I'd use an `in` for that, for a similar query. In code, something like....

val top1 = paras.map(_.returnPathDomain_id).take(1)

val query = 
   localdomains.filter(_.localDomain_id in top1).map(_.localDomain_domain)


Does that help?  
Cheers

Richard

--

---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/2621c95a-b3a7-43fb-8669-f2e2eff26575%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages