Fix group by
frustratingly nondeterministic errors were just a bad query?
Merge pull request #1785 from bendiy/4_6_x

Fix group by
Merge pull request #1843 from xtuple/4_6_x

4 6 x