Test case for #165 - Incorrect join used when query language with where
expression has a many property and ends with a foreign key column