select b.user.uid,coun t(b.id) from BPH as b where b.bp.active=tru e and b.bp.type=0 and b.user.id in (select u.id from U as u where u.active=true)g roup by b.user.id order by count(b.id)
It calculates the count of b.id by grouping the user.id but, the records are not sorted based on the count of b.id
Any one can help me to solve this