Support otm self referenced tables
Fix sql joins test