UnionAll 3 queries

19 views
Skip to first unread message

Balázs Mária Németh

unread,
Apr 17, 2014, 12:45:29 PM4/17/14
to scala...@googlegroups.com
hi,

I'm trying to union all multiple queries.

    val q1 = for {
      (p, pv) <- properties join propertyvalues on (_.id === _.propertyId)
      if (p.id === p1._1) && (pv.value === p1._2)
    } yield (pv.productId)

    val q2 = for {
      (p, pv) <- properties join propertyvalues on (_.id === _.propertyId)
      if (p.id === p2._1) && (pv.value === p2._2)
    } yield (pv.productId)

    val un = q1 unionAll q2

So far so good.

But I'd need more than these two, like:

    val q1 = for {
      (p, pv) <- properties join propertyvalues on (_.id === _.propertyId)
      if (p.id === p1._1) && (pv.value === p1._2)
    } yield (pv.productId)

    val q2 = for {
      (p, pv) <- properties join propertyvalues on (_.id === _.propertyId)
      if (p.id === p2._1) && (pv.value === p2._2)
    } yield (pv.productId)

    val q3 = for {
      (p, pv) <- properties join propertyvalues on (_.id === _.propertyId)
      if (p.id === p3._1) && (pv.value === p3._2)
    } yield (pv.productId)

    val un = q1 unionAll q2 unionAll q3

And now I get SlickException: JdbcProfile has no TypeInfo for type NominalType(t2).

Any ideas?
Reply all
Reply to author
Forward
0 new messages