I suspect that you're trying to use Field.ge(Select):
http://www.jooq.org/javadoc/latest/org/jooq/Field.html#ge(org.jooq.Select)
as in
create.selectFrom(B)
.where(B.SOME_DATE.ge(
select(max(A.SOME_DATE))
.from(A)
.where(A.ID.in(1, 2, 3))
));
If your first query is indeed intended for reuse in several other queries,
I guess you've just mixed up "asTable()" and "asField()" as your subselect
is not really a derived table ("asTable()"), but a column expression
("asField()")...
Hope this helps
Cheers
Lukas
2013/3/4 Peter Cooner <[email protected]>
> So I'm stuck trying to figure out how to do this nested select in jOOQ 3:
>
>
> Assuming two tables, A and B that have a 1 to many foreign key
> relationship -
>
> Table<ARecord> a1 = create.select(A.ID, max(A.SOME_DATE).as("max"))
> .from(A).where(A.ID.in(1,2,3).asTable("a1");
>
> create.selectFrom(B).where(B.SOME_DATE.ge(a1.field("max")));
>
>
> This doesn't work because a1.field() has lost its type.
>
> So how do implement this properly?
>
>
>
>
> http://www.jooq.org/doc/3.0/manual/sql-building/table-expressions/nested-selects/
>
>
> Pete
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.