java - JOOQ: Select keys from a table not present in another table -
how keys in 1 table not present in table in jooq? or equivalent of following sql command:
select id id not in (select id b)
this 1:1 translation jooq:
dsl.using(configuration) .select(a.id) .from(a) .where(a.id.notin(select(b.id).from(b))) .fetch(); the above assuming static import such:
import static org.jooq.impl.dsl.*; a note on using not in
the sql not in predicate works correctly when subquery not yield null values. in presence of single null value, entire predicate not return rows.
it better use not exists as shown in answer. or in jooq:
dsl.using(configuration) .select(a.id) .from(a) .where(notexists(selectone().from(b).where(b.id.eq(a.id)))) .fetch();
Comments
Post a Comment