How to implement "select sum()" in Grails
- by xain
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