working groupBy Query