Elisabeth Trons
Elisabeth Trons

Reputation: 135

jOOQ - array of select query

Does jOOQ support array of select query? I want something like the following:

select table.*, array(select another_table.id from another_table where ...)
from   table;

I tried experimenting with DSL.array(context.select(...).asField()) but this generates array[(select ...)] instead of array(select(...)).

Upvotes: 4

Views: 1064

Answers (1)

Elisabeth Trons
Elisabeth Trons

Reputation: 135

I should have done:

PostgresDSL.array(context.select(...))

Note that we are using PostgresDSL instead of the generic DSL and not applying .asField() to the select, to inline the inner select query into the outer query.

Upvotes: 7

Related Questions