Reputation: 605
I think the title is quite self-explanatory. How can I use fetched plain sql as derived table in nested selects?
For example I want to fetch
select a.a, a.b from (select c.a, c.b from c) as a
and the
(select c.a, c.b from c)
part is a complicated postgres query which is not supported by JOOQ.
How can I make something like this:
nested = create.fetch("select c.a, c.b from c")
create.select(...)
.from(nested)
.fetch
Upvotes: 2
Views: 414
Reputation: 220762
Table<?> nested = DSL.table("(select c.a, c.b from c)").as("a")
create.select(...)
.from(nested)
.fetch();
Upvotes: 2