Refs #6786  There is a possibility that the current codebase contains a bug in the inner segment queries logic which is used to always group by idvisit but maybe in some cases this doesn't make sense or would create bugs in the data