Couldn't this line simple by a part of joinOn?
You're doing exactly the same thing here and down in the asIs (AND where)