Hello everyone,

I want to join twice between a project table and a user table.

Users can be attached to a project in the role as project leader or deputy.

So far I tried(and different versions):
var p = ProjectdbProject.PROJECTDB_PROJECT;
var pl = SecuritydbUser.SECURITYDB_USER;

int i = dbcontext.fetchCount(DSL.selectDistinct(p.ID)
.from(p)
.join(pl).on(p.FK_PROJECT_LEADER.eq(pl.ID))
.join(pl).on(p.FK_DEPUTY.eq(pl.ID))
.where(condition)
.groupBy(p.ID));

but the result was always this exception:
Caused by: org.postgresql.util.PSQLException: ERROR: table name 
"securitydb_user" specified more than once
at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
 
~[postgresql-42.6.0.jar:42.6.0]
at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
 
~[postgresql-42.6.0.jar:42.6.0]

Any ideas?
Thanks alot!

I search in the master class book but could not find any example covering 
joining the same table twice.

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/62d9594b-4c62-48ed-a29d-a07bb89f8d20n%40googlegroups.com.

Reply via email to