I'm trying to figure out the syntax to update a row from a subquery to
another table. In sql it would look like this:
update Eval set totalScore = (select sum(score) from answer where
evalid = eval.id) where id = [xyz]
I tried the following:
update (evals) (e =>
where (e.id === id)
set (e.totalScore := from(answers)(a => where(a.evalId === [xyz])
compute (sum(a.score)))
)
This results in this error:
could not find implicit value for evidence parameter of type
(org.squeryl.dsl.Measures[Option[org.squeryl.PrimitiveTypeMode.IntType]]])
=> org.squeryl.dsl.ast.TypedExpressionNode[org.squeryl.PrimitiveTypeMode.IntType]
For testing purposes I also tried removing the aggregate, but it can't
get it to work either:
update (evals) (e =>
where (e.id === id)
set (e.totalScore := from(answers)(a => where(a.evalId === id)
select (a.score))
)
This gives me a similar error:
could not find implicit value for evidence parameter of type
(org.squeryl.Query[Int]) =>
org.squeryl.dsl.ast.TypedExpressionNode[org.squeryl.PrimitiveTypeMode.IntType]
Am I getting the syntax wrong or is this not supported right now? I
couldn't find a similar sample in the docs.
Thanks
Vincent
I tried but I don't seem to have the option to do so. There's no "new
ticket" button after I login.
Thanks,
Vincent
2011/1/25 Maxime Lévesque <maxime....@gmail.com>:
--
Vincent Côté-Roy
I did and I still can't. I seem to have only read-only access to tickets.
--
Vincent Côté-Roy
--
You received this message because you are subscribed to the Google Groups "Squeryl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to squeryl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
update(widgets) (
w=>
where(w.id === 2)
set(w.foo := from(widgets)(prevW => where(prevW.id === 1) compute(min(foo))))
)