3

这是我的问题,我正在尝试在 where 条件下添加 Select 查询,如何在 Jooq 中实现这一点?

selectQuery.addFrom(DefaultInfo.DEFAULT_INFO);
selectQuery.addConditions(DefaultInfo.DEFAULT_INFO.FOLDER_TYPE=+"(Select FolderType From Folder Where Folder.FolderRSN = folderRSN )" );

我知道这是错误的,但是如何在另一个查询条件中添加选择查询输出?

4

1 回答 1

2

Use the Field.in(Select<? extends Record1<T>>) method on your column. For example:

DEFAULT_INFO.FOLDER_TYPE.in(
    select(FOLDER.FOLDER_TYPE)
   .from(FOLDER)
   .where(FOLDER.FOLDER_RSN.eq("folderRSN"))
)

The IN predicate is documented in the manual, here:

于 2013-09-27T09:06:04.813 回答