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

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -