merge MMcM: When converting a subquery to a semi-join, be careful about where its WHERE conditions end up

Merge pull request #1236 from MMcM/sql-layer/sql-in-subquery-where-put-where
https://github.com/FoundationDB/sql-layer/pull/1236
Add a test that demonstrates the problem.
The outer side of a group join needs to be included in the Flatten always, since it makes more rows appear with nulls.
Adjust existing test.