separate group and having