1

I'm trying to join a Card with a Part and left join a summed Stock value to a part (some parts won't have a stock row).

I have the following which I thought would work..

def stockPerBase = from(stock)(s => groupBy(s.base) compute(sum(s.quantity)))
def allCardsWithStock = 
    join(cards, parts, stockPerBase.leftOuter)((c,p,s) =>
        on(c.partId === p.id, p.base === s.map(_.key))  
        select(c, p, s.measures))

However I get the following error:

too many arguments for method on: (table: org.squeryl.Table[A])(declarations: A => Seq[org.squeryl.dsl.ast.BaseColumnAttributeAssignment])Unit
[error] on(c.partId === p.id, p.base === s.map(_.key))  

Any help on how I can do such a query is greatly apprecited.

Alex
  • 1,322
  • 1
  • 20
  • 44

1 Answers1

2

The select clause should come before the on in your query. Try reversing the order of the two clauses and it should work.

jcern
  • 7,798
  • 4
  • 39
  • 47