Eng 6436 distinct reroute

This is the fast, simple but not the best efficient solution for DISTINCT with GROUP BY cases. We will create tickets to optimize it later.
The purpose of this base query without distinct would be clearer if it came right before the similar query query that adds DISTINCT without the unrelated one-column query in between.