我在子查询的.where上收到以下编译器错误( .where(parentHelp.SUBJECT_ID = IFS_HELP.PARENT_SUBJECT_ID)):
SelectWhereStep< Record1< String>>类型中的(条件...)方法不适用于参数(TableField< IfsHelpRecord,Long>)
当我有以下jOOQ子查询代码时:
IfsHelp parentHelp = IFS_HELP.as( "parentHelp" ); Field<Object> parent_help_subject = sqlca .select( IFS_HELP.SUBJECT_NAME ) .from( parentHelp ) .where( parentHelp.SUBJECT_ID = IFS_HELP.PARENT_SUBJECT_ID ) .asField( "parent_help_subject" ); results = sqlca .select( IFS_HELP.SUBJECT_NAME, IFS_HELP.SUBJECT_ID, parent_help_subject ) .from( IFS_HELP ) .where( IFS_HELP.HELP_TEXT.like( argument ) ) .and( IFS_HELP.DISPLAY.equal( "Y" ) ) .orderBy( IFS_HELP.SUBJECT_NAME.asc() ) .limit( 50 ) .fetch();
数据库表如下所示:
IFS_HELP
SUBJECT_ID (bigint, pk)
SUBJECT_NAME (varchar)
PARENT_SUBJECT_ID (bigint, fk back to ifs_help.subject_id)
HELP_TEXT (varchar)
DISPLAY (char)
这是我要执行的查询:
SELECT ifs_help.subject_name, ifs_help.subject_id, ifs_isNull( ( select subject_name from ifs_help P where P.subject_id = ifs_help.parent_subject_id ), '' ) as parent_help_subject FROM ifs_help WHERE ifs_help.help_text like argument AND ifs_help.display = 'Y' ORDER BY ifs_help.subject_name ASC LIMIT 50