Change subquery to actually use parent relation (+tests)