How to implement "select sum()" in Grails
Posted
by xain
on Stack Overflow
See other posts from Stack Overflow
or by xain
Published on 2010-04-26T02:51:03Z
Indexed on
2010/04/26
2:53 UTC
Read the original article
Hit count: 242
I have a relationship like this:
class E {
string name
hasMany = [me:ME]
}
class M {
float price
}
class ME {
E e
M m
int quantity
}
And I'd hate to iterate to achieve this: "obtain the sum of the quantity in ME times the price of the corresponding M for a given E".
Any hints on how to implement it using GORM/HQL ?
Thanks in advance
© Stack Overflow or respective owner