fix(relationships): distinct ege* results when relationship_guid is not set

elgg_get_entities_from_relationship() was returning duplicate entities when
relationship_guid was not set. This was likely caused by MySQL optimizing
the query and using a different index to fulfill the r.id select.
Specifying group_by in cases where relationship_guid is not set fixes the issue.

Fixes #5775