get all groups by groupids in an ascending order