There are two tables. Each client has 2 addresses. I need to select the client name and string of addresses. I’m confused about jooq syntax
Table CLIENT
id | name | BASIK_OFICE_ID | ADDITIONAL_OFICE_ID
Table OFICE
id | address
TABLE RESULT
name | basic_address | additional_address
public record ClientAndOfficeData(
String name,
String basic_address,
String additional-address) {}
var content =
context
.select(
CLIENT.NAME,
OFFICE.ADDRESS,
OFFICE.ADDRESS)
.from(CLIENT)
.innerJoin(OFICE)
.on(OFFICE.ID.eq(CLIENT.BASIK_OFFICE_ID))
.or(OFFICE.ID.eq(CLIENT.ADDITIONAL_OFFICE_ID))
.fetchInto(ClientAndOfficeData.class);
}
New contributor
Yula is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1