Join on two tables?

Hi everybody,

I'm building an app that allows users (representatives from companies) to apply for a personal budget for their employees. These applications are registered in an entity named Application, each of which has a corresponding Applicant ID (which refers to the representative from the company). The personal data from the Applicant are registered in the Person Entity. So the aggregate that I use to return the application info for each Applicant looks like this:


I use this aggregate to return the Applicant's name and surname.

I would also like to use it to return the name and surname of the Employees that correspond to the Applicant. The Employees are also registered in a separate entity and they have their own ID. Their name and surname are also registered in the Person entity.

I know how to join the Employee entity with this table. But how do I join the Person entity to the Employee entity after that while still differentiating between the data belonging to the Employee and not the Applicant? Because right now, the following only refer to the Applicant's name and surname:

GetApplicationsByApplicantId.List.Current.Person.Name
GetApplicationsByApplicantId.List.Current.Person.Surname

Hello,

You can join the same table more than once, even using different join conditions for both. And you can change the name of the Source Table to what you want.
You can have a Source Table "ApplicantPerson" and "EmployeePerson", both being the "Person" Table.

Best regards.

Champion
Solution

Hi

You can add another Person Entity to the soruce as Person2, and join Person2 to Employee.

Then you can get the Employee name like below.

GetApplicationsByApplicantId.List.Current.Person2.Name
GetApplicationsByApplicantId.List.Current.Person2.Surname

Regards,

Hello,

You can join the same table more than once, even using different join conditions for both. And you can change the name of the Source Table to what you want.
You can have a Source Table "ApplicantPerson" and "EmployeePerson", both being the "Person" Table.

Best regards.

Champion
Solution

Hi

You can add another Person Entity to the soruce as Person2, and join Person2 to Employee.

Then you can get the Employee name like below.

GetApplicationsByApplicantId.List.Current.Person2.Name
GetApplicationsByApplicantId.List.Current.Person2.Surname

Regards,

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.