Simplify where/group_by in select by using named children