spring - How can I divide two HQL Count Results? -
i want compute percentage of people not active divided percentage of people being active.
i following hql query did not work:
(select count(x) people x x.active=false) / (select count(x) people x x.active=true)
how can that?
you can use group clause express this. here's how in grails:
def countbyaction = people. executequery("select active, count(*) people group active")*. tolist(). collectentries{it} println (countbyaction[true]) println (countbyaction[false])
Comments
Post a Comment