Reputation: 13666
I'm using jOOQ for a Postgresql DB.
I need to run a query like:
SELECT tablea.* FROM tablea
JOIN tableb ON tableb.id = ANY(tablea.array_of_ints)
However I don't find any example of using any in a join with jOOQ. I tried
dsl.select().from(TABLEA).join(TABLEB).on(TABLEB.ID,
DSL.any(TABLEA.ARRAY_OF_INTS)).fetch().into(TableA);
But is wrong.
Any idea?
Upvotes: 3
Views: 316
Reputation: 13666
The answer is
dsl.select().from(TABLEA).join(TABLEB)
.on(TABLEB.ID.equal(DSL.any(TABLEA.ARRAY_OF_INTS)))
.fetch().into(TableA);
Upvotes: 2