get condition from foreign key