groovebucket
groovebucket
DTDrizzle Team
Created by groovebucket on 6/24/2023 in #help
many-many with
I know that I can do:
db
.select()
.from(users)
.leftJoin(usersToRoles, eq(usersToRoles.userId, users.id))
.leftJoin(roles, eq(roles.id, usersToRoles.roleId))
.where(eq(users.username, "admin"));
db
.select()
.from(users)
.leftJoin(usersToRoles, eq(usersToRoles.userId, users.id))
.leftJoin(roles, eq(roles.id, usersToRoles.roleId))
.where(eq(users.username, "admin"));
and massage the result into what I want. But, I'm wondering whether there might be a way to get there using relational queries.
2 replies