Fixes #12423 - Additional select columns are removed when using includes

The additional selects need to be merged into the relation, which can be written in various forms. The distinct takes care of any duplicates.